pytfc


Namepytfc JSON
Version 0.0.23 PyPI version JSON
download
home_pagehttps://github.com/alexbasista/pytfc
SummaryPython HTTP client library for Terraform Cloud/Enterprise API.
upload_time2023-11-09 12:44:30
maintainer
docs_urlNone
authorAlex Basista
requires_python
license
keywords tfe terraform enterprise tfc terraform cloud terraform
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pytfc
Python HTTP client library for the Terraform Cloud and Terraform Enterprise API.

```python
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:
```python
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:
```python
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:
```python
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:
```python
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](./docs/) for more details and examples on usage.
<p>&nbsp;</p>

---
> Note: this is repository is not officially supported or maintained by HashiCorp.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/alexbasista/pytfc",
    "name": "pytfc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "tfe,terraform enterprise,tfc,terraform cloud,terraform",
    "author": "Alex Basista",
    "author_email": "alex.basista@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/57/a5/ee1e7ffdb837643cb8fb466cd115b362c53fb1f4cf2dcd19cfa93203cac3/pytfc-0.0.23.tar.gz",
    "platform": null,
    "description": "# pytfc\nPython HTTP client library for the Terraform Cloud and Terraform Enterprise API.\n\n```python\nimport pytfc\nclient = pytfc.Client(org='my-tfe-org')\nclient.workspaces.create(name='aws-base-vpc-dev')\nclient.set_ws(name='aws-base-vpc-dev')\nclient.workspace_variables.create(key='AWS_ACCESS_KEY_ID', value='ABCDEFGHIJKLMNOPQRST', category='env', sensitive='true')\nclient.workspace_variables.create(key='AWS_SECRET_ACCESS_KEY', value='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCD', category='env', sensitive='true')\n```\n\n## Usage\nA _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.\n\n### Instantiating a Client\nWith environment variables:\n```python\nos.environ['TFE_HOSTNAME']='tfe.whatever.com'\nos.environ['TFE_TOKEN']='abcdefghijklmn.atlasv1.opqrstuvwxyz012345678987654321abcdefghijklmnopqrstuvwxyz01234567890'\n\nclient = pytfc.Client(org='my-existing-tfe-org')\n```\n\nDirectly as function arguments:\n```python\nclient = pytfc.Client(hostname='tfe.whatever.com', token='abcdefghijklmn.atlasv1.opqrstuvwxyz012345678987654321abcdefghijklmnopqrstuvwxyz01234567890', org='my-existing-tfe-org')\n```\n\nSetting the Organization and Workspace when a client is instantiated:\n```python\nclient = pytfc.Client(org='my-existing-tfe-org', ws='my-existing-tfe-ws')\n```\n> Assumes the TFE_HOSTNAME and TFE_TOKEN environment variables are set.\n\nSetting the Organization and Workspace _after_ a client is instantiated:\n```python\nclient = pytfc.Client()\nclient.set_org(name='my-existing-tfe-org')\nclient.set_ws(name='my-existing-tfe-ws')\n```\n> Assumes the TFE_HOSTNAME and TFE_TOKEN environment variables are set.\n\n\\\nSee the [docs](./docs/) for more details and examples on usage.\n<p>&nbsp;</p>\n\n---\n> Note: this is repository is not officially supported or maintained by HashiCorp.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python HTTP client library for Terraform Cloud/Enterprise API.",
    "version": "0.0.23",
    "project_urls": {
        "Homepage": "https://github.com/alexbasista/pytfc"
    },
    "split_keywords": [
        "tfe",
        "terraform enterprise",
        "tfc",
        "terraform cloud",
        "terraform"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db42942cd4958f7789765b7c3f70587cfbdac15100a75cd86a82140e6182827f",
                "md5": "27c98720bb484752cba10a7ee11017d7",
                "sha256": "6471690735bfd6c9129a89ff3e527d4fdc34d05ec15821820835baeacfc1aada"
            },
            "downloads": -1,
            "filename": "pytfc-0.0.23-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "27c98720bb484752cba10a7ee11017d7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 46931,
            "upload_time": "2023-11-09T12:44:28",
            "upload_time_iso_8601": "2023-11-09T12:44:28.865201Z",
            "url": "https://files.pythonhosted.org/packages/db/42/942cd4958f7789765b7c3f70587cfbdac15100a75cd86a82140e6182827f/pytfc-0.0.23-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57a5ee1e7ffdb837643cb8fb466cd115b362c53fb1f4cf2dcd19cfa93203cac3",
                "md5": "e0fe9a333880976172ad9666f70c52f0",
                "sha256": "763b7c6802211fb9b657da75bbba7ad493d2767c8a42ac14ec1ab64ed7fd00d6"
            },
            "downloads": -1,
            "filename": "pytfc-0.0.23.tar.gz",
            "has_sig": false,
            "md5_digest": "e0fe9a333880976172ad9666f70c52f0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 29951,
            "upload_time": "2023-11-09T12:44:30",
            "upload_time_iso_8601": "2023-11-09T12:44:30.331745Z",
            "url": "https://files.pythonhosted.org/packages/57/a5/ee1e7ffdb837643cb8fb466cd115b362c53fb1f4cf2dcd19cfa93203cac3/pytfc-0.0.23.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-09 12:44:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alexbasista",
    "github_project": "pytfc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pytfc"
}
        
Elapsed time: 0.45741s