A Python Client for the Terraform Cloud API.
The goal of this project is to support all endpoints available in the Terraform Cloud API. It's possible that some of these endpoints won't work if you're working against an older version of Terraform Enterprise.
Note: This project is tested against Terraform Enterprise often, but the code coverage
represented in this repo will always represent coverage against Terraform Cloud
Business Tier (skipping all admin
modules), so the coverage percentage
is higher than represented in the badge.
Terraform Enterprise Release Notes
Note: Terraform Enterprise is the self-hosted distribution of Terraform Cloud. It offers enterprises a private instance of the Terraform Cloud application, with no resource limits and with additional enterprise-grade architectural features like audit logging and SAML single sign-on.
For more details on using each endpoint, check out the
docs or the test
directory.
from terrasnek.api import TFC
import os
TFC_TOKEN = os.getenv("TFC_TOKEN", None)
TFC_URL = os.getenv("TFC_URL", None) # ex: https://app.terraform.io
# set to True if you want to use HTTP or insecure HTTPS
SSL_VERIFY = os.getenv("SSL_VERIFY", False)
if __name__ == "__main__":
api = TFC(TFC_TOKEN, url=TFC_URL, ssl_verify=SSL_VERIFY)
api.set_org("YOUR_ORGANIZATION")
To compare terrasnek
implemented endpoints to those listed on the Terraform
Cloud API docs, view the auto-generated
TERRASNEK_API_COVERAGE_COMPLETENESS.md
file.
See the terrasnek
documentation.
If you'd like to contribute to terrasnek
, review CONTRIBUTING.md
.
- Migrating a Lot of State with Python and the Terraform Cloud API
- The Power of the Terraform API: How to Easily Migrate Any Data Between Enterprise and Cloud
Note: This repo is not officially maintained by HashiCorp.