https://github.com/jamiewri/terraform-cloud-tag-orchestration
Searching Terraform Cloud workspaces using tags.
https://github.com/jamiewri/terraform-cloud-tag-orchestration
golang sdk terraform terraform-cloud
Last synced: 3 months ago
JSON representation
Searching Terraform Cloud workspaces using tags.
- Host: GitHub
- URL: https://github.com/jamiewri/terraform-cloud-tag-orchestration
- Owner: jamiewri
- Created: 2022-05-07T05:50:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-07T09:03:59.000Z (about 3 years ago)
- Last Synced: 2025-01-11T17:53:32.973Z (4 months ago)
- Topics: golang, sdk, terraform, terraform-cloud
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# terraform-cloud-tag-orchestration
# Purpose
This tool was written as an example of how to use the [go-tfe](https://github.com/hashicorp/go-tfe) library to search workspaces using tags. It has limited error handeling but could be used as a starting point for someone looking to explore automating [Terraform Cloud](https://app.terraform.io) in [Go](https://github.com/golang/go).In the context of this readme, TFE, TFC and Terraform Cloud are used interchangeably.
## Requirements
Required environment variables
| Env | Description |
|-----|-------------|
| TFC_ORGANIZATION | Terraform Cloud organization |
| TFC_ORGANIZATION_TOKEN | [Terraform Cloud organization token](https://www.terraform.io/cloud-docs/users-teams-organizations/users#api-tokens) |## Usage
```
$ export TFC_ORGANIZATION="your...tfc...org...here"
$ export TFC_ORGANIZATION_TOKEN="your...tfc...token...here"
$ ./tfcinfo {space} {seperated} {tags}
workspace-1-matching-tags
workspace-2-matching-tags
```### Example
```
$ ./tfcinfo aws demo
Terraform cloud orchestration with tags
Organization: devopstower
Searching for workspaces with the following tags: aws,demo
tfc-aws-network-prod
tfc-aws-network-dev
```## Build
```
go build -o tfcinfo .
```