pytfc
Python HTTP client library for the Terraform Cloud and Terraform Enterprise API.
import pytfc
client = pytfc.Client(org='my-tfe-org')
client.workspaces.create(name='aws-base-vpc-dev')
client.set_ws(name='aws-base-vpc-dev')
client.workspace_variables.create(key='AWS_ACCESS_KEY_ID', value='ABCDEFGHIJKLMNOPQRST', category='env', sensitive='true')
client.workspace_variables.create(key='AWS_SECRET_ACCESS_KEY', value='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCD', category='env', sensitive='true')
Usage
A client object must be instantiated with certain parameters. The parameters can be specified as environment variables or directly as function arguments. The only parameter required at the time a client is instantiated is the API token. A hostname is also required if you are using TFE, and if a hostname is not specified it is assumed you are using TFC (app.terraform.io). Depending on what level you are working at, mainly Organization-level vs. Workspace-level, you can optionally set some of the other parameters either at the time the client is instantiated or after the fact.
Instantiating a Client
With environment variables:
os.environ['TFE_HOSTNAME']='tfe.whatever.com'
os.environ['TFE_TOKEN']='abcdefghijklmn.atlasv1.opqrstuvwxyz012345678987654321abcdefghijklmnopqrstuvwxyz01234567890'
client = pytfc.Client(org='my-existing-tfe-org')
Directly as function arguments:
client = pytfc.Client(hostname='tfe.whatever.com', token='abcdefghijklmn.atlasv1.opqrstuvwxyz012345678987654321abcdefghijklmnopqrstuvwxyz01234567890', org='my-existing-tfe-org')
Setting the Organization and Workspace when a client is instantiated:
client = pytfc.Client(org='my-existing-tfe-org', ws='my-existing-tfe-ws')
Assumes the TFE_HOSTNAME and TFE_TOKEN environment variables are set.
Setting the Organization and Workspace after a client is instantiated:
client = pytfc.Client()
client.set_org(name='my-existing-tfe-org')
client.set_ws(name='my-existing-tfe-ws')
Assumes the TFE_HOSTNAME and TFE_TOKEN environment variables are set.
See the docs for more details and examples on usage.
Note: this is repository is not officially supported or maintained by HashiCorp.
Metadata
Release files for pytfc 0.0.23
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytfc-0.0.23.tar.gz | 30.0 kB | Without provenance | Details for pytfc-0.0.23.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytfc-0.0.23-py3-none-any.whl | Python 3 | none | any | Details for pytfc-0.0.23-py3-none-any.whl |
Total release size: 76.9 kB
Release files / pytfc-0.0.23.tar.gz
| Download URL | pytfc-0.0.23.tar.gz |
|---|---|
| Size | 30.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
763b7c6802211fb9b657da75bbba7ad493d2767c8a42ac14ec1ab64ed7fd00d6
|
|
BLAKE2b-256 checksum How to use checksums |
57a5ee1e7ffdb837643cb8fb466cd115b362c53fb1f4cf2dcd19cfa93203cac3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / pytfc-0.0.23-py3-none-any.whl
| Download URL | pytfc-0.0.23-py3-none-any.whl |
|---|---|
| Size | 46.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6471690735bfd6c9129a89ff3e527d4fdc34d05ec15821820835baeacfc1aada
|
|
BLAKE2b-256 checksum How to use checksums |
db42942cd4958f7789765b7c3f70587cfbdac15100a75cd86a82140e6182827f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for pytfc 0.0.23
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.