Skip to content

Searching Terraform Cloud workspaces using tags.

Notifications You must be signed in to change notification settings

jamiewri/terraform-cloud-tag-orchestration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-cloud-tag-orchestration

Purpose

This tool was written as an example of how to use the 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 in 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

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 .