Skip to main content

Make Terraform Cloud API calls for common platform administration tasks.

Project description

Overview

Make Terraform Cloud API calls for common platform administration tasks.

Reference

Terraform Cloud API Documentation

Available Functions

  • Show organization details

  • List teams

  • List projects

  • Get project ID from project name

  • List workspaces in a project

  • Get workspace ID from workspace name

  • Move workspace into a project

Examples

import sys
import tfc_admin

# List all teams in an organization.
teams_list = []
page_number = 1

# Iterate through all pages of teams.
while True:
   teams = tfc_admin.get_teams(
      sys.argv[1],  # token
      sys.argv[2],  # organization
      page_number
   )
   if not teams['data']:
      break
   for team in teams['data']:
      teams_list.append(team['attributes']['name'])
   page_number += 1

# Print the list of teams.
print(teams_list)

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

tfc_admin-1.1.0.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

tfc_admin-1.1.0-py3-none-any.whl (3.0 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