Metadata-Version: 2.1
Name: terraform_rums
Version: 1.0.0
Summary: Get Terraform RUM statistics.
Home-page: https://gitlab.com/fer1035_python/modules/pypi-terraform_rums
License: GPL-2.0-only
Keywords: Terraform,Cloud,RUM,statistics,quota,limit,usage,API,billing
Author: Ahmad Ferdaus Abd Razak
Author-email: fer1035@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: requests (>=2.27.1,<3.0.0)
Project-URL: Repository, https://gitlab.com/fer1035_python/modules/pypi-terraform_rums
Description-Content-Type: text/x-rst

==================
**terraform_rums**
==================

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:

.. code-block:: BASH

   pip3 install terraform_rums
   # or
   python3 -m pip install terraform_rums

Bash:

.. code-block:: BASH

   tfc_rums -o <organization> -t <token> -f <filename> -u <api_url> -p <page_size> -d <delay>

Python:

.. code-block:: 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:

.. code-block:: BASH

   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:

.. code-block:: TXT

   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

