Skip to main content

Simple Wrapper for Terraform Enterprise 2 Jobs

Project description

Copyright (c) 2017 Rory Chatterton

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Description: # Terraform 2 SDK [![Build Status](https://travis-ci.org/westpac-cloud-engineering/Terraform-Enterprise-2-Python-SDK.svg?branch=master)](https://travis-ci.org/westpac-cloud-engineering/Terraform-Enterprise-2-Python-SDK) [![codecov](https://codecov.io/gh/westpac-cloud-engineering/Terraform-Enterprise-2-Python-SDK/branch/master/graph/badge.svg)](https://codecov.io/gh/westpac-cloud-engineering/Terraform-Enterprise-2-Python-SDK)

SDK to call Terraform Enterprise 2 using Python.

This SDK was developed to wrap Restful API calls to Terraform Enterprise 2, in order to trigger Plans, Applys and Variable updates using Jenkins.

## How to install

```
pip install te2_sdk
```

## Triggering a Run
Below is an example of how you trigger a plan

```python
from te2_sdk import te2

client = te2.TE2Client(
organisation="MY_TERRAFORM_ENTERPRISE_ORG",
atlas_token="SECRET_TOKEN_HERE",
base_url="https://atlas.hashicorp.com/api/v2" # Change this if you are using a private install
)

ws_runs = te2.TE2WorkspaceRuns(client=client, workspace_name="My Workspace Name" )
run = ws_runs.request_run(request_type="plan", destroy=False)

```

And to do a run:
```python
run = ws_runs.request_run(request_type="apply", destroy=False, run_id = "RUN_ID_FROM_PLAN")
```

### Completed Functionality

- [x] Runs
- [x] Plan
- [x] Run
- [x] Discard
- [x] Get Log
- [x] Variables
- [x] Create
- [x] Read
- [x] Update
- [x] Delete

### Incomplete Functionality
The following items are not in development, as these Day 0 operations will eventually be wrapped up in an official Terraform Provider.
- [ ] Workspaces
- [ ] Sentinel
- [ ] Teams
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Text Processing

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

te2_sdk-0.1.5.tar.gz (10.5 kB view hashes)

Uploaded Source

Built Distribution

te2_sdk-0.1.5-py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 3

Supported by

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