Created
April 13, 2021 07:40
-
-
Save nomaster/8d8981c55d61c7106ac87c30ebbb3a89 to your computer and use it in GitHub Desktop.
Run all Terraform workspaces matching name by string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pyterprise | |
import os | |
tfe_token = os.environ.get('TFE_TOKEN') | |
tfe_org = os.environ.get('TFE_ORG') | |
client = pyterprise.Client() | |
client.init(token=tfe_token, url="https://app.terraform.io") | |
org = client.set_organization(id=tfe_org) | |
for workspace in org.search_workspaces('dns-netbox'): | |
workspace.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment