Skip to main content

Get Terraform RUM statistics.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

terraform_rums-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

terraform_rums-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file terraform_rums-1.0.0.tar.gz.

File metadata

  • Download URL: terraform_rums-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/5.15.154+

File hashes

Hashes for terraform_rums-1.0.0.tar.gz
Algorithm Hash digest
SHA256 89cf9a07162c439b5a76116172f78ed894c11c79e2cd722d5cb4bf57cf07b470
MD5 0cffd17a88005d07f0c684f3ea825468
BLAKE2b-256 3acba07806c7c885594bbc7012f89d93105b3445743e8c273e12bac1df734eaf

See more details on using hashes here.

File details

Details for the file terraform_rums-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: terraform_rums-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/5.15.154+

File hashes

Hashes for terraform_rums-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a0a713f521e3b3e0f32c5e682655e73255f6ab839809e8408f54f2b6b785978
MD5 5eb2a03681c333d5cdb0e44aba737ef6
BLAKE2b-256 dda5d62288d55d9dd2c6557f1529cf849255637a4cf9c6914bf5a121df0d90ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page