Overview
A Python module to call the Terraform Cloud API and retrieve data for Resources Under Management (RUMs).
> CAUTION! This may take a while to run if the Organization has a large number of Workspaces.
Usage
Installation:
pip3 install terraform_rums
# or
python3 -m pip install terraform_rums
Bash:
tfc_rums -o <organization> -t <token> -f <filename> -u <api_url> -p <page_size> -d <delay>
Python:
import terraform_rums as tfr
quota = tfr.get_subscription_rums(
<organization>,
<token>,
<api_url>
)
rums = tfu.get_workspace_data(
<organization>,
<token>,
<api_url>,
<page_size>,
<delay>,
quota
)
Execution example:
tfc_rums -o myorg -t mytoken -f myfile.csv
Terraform RUM Statistics
-------
Run parameters:
Organization: myorg
Filename: myfile.csv
API URL: https://app.terraform.io/api/v2
Page size: 50
Delay: 1.0
-------
Reading Workspace: aws-myworkspace-dev...
Reading Workspace: aws-myworkspace-prod...
Reading Workspace: aws-myworkspace-test...
-------
Workspaces: 3
Quota: 500
RUMs: 10
Billable RUMs: 10
Delta: 490
Usage percentage: 2.00%
-------
Writing data to myfile.csv...
Output in CSV file example:
workspace_id,workspace_name,rum_count,billable_rum_count
aws-myworkspace-dev,2,2
aws-myworkspace-prod,5,5
aws-myworkspace-test,3,3
Arguments
organization - Terraform Cloud Organization name. Required.
token - Terraform Cloud API token. Required.
filename - CSV filename to save the output data to. Default is “report.csv”.
api_url - Terraform Cloud API URL. Default is “https://app.terraform.io/api/v2”.
page_size - Number of items per page. Default is 50.
delay - Delay (in seconds) between API calls. Default is 0.0.
API Documentation
https://developer.hashicorp.com/terraform/cloud-docs/api-docs
Release files for terraform_rums 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| terraform_rums-1.0.0.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| terraform_rums-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / terraform_rums-1.0.0.tar.gz
| Download URL | terraform_rums-1.0.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89cf9a07162c439b5a76116172f78ed894c11c79e2cd722d5cb4bf57cf07b470
|
|
BLAKE2b-256 checksum How to use checksums |
3acba07806c7c885594bbc7012f89d93105b3445743e8c273e12bac1df734eaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/5.15.154+
|
Release files / terraform_rums-1.0.0-py3-none-any.whl
| Download URL | terraform_rums-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a0a713f521e3b3e0f32c5e682655e73255f6ab839809e8408f54f2b6b785978
|
|
BLAKE2b-256 checksum How to use checksums |
dda5d62288d55d9dd2c6557f1529cf849255637a4cf9c6914bf5a121df0d90ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/5.15.154+
|