CLI client for Terraform Enterprise.
For Linux/OSX, run the following command from a terminal to get the latest version:
bash <(curl -sSfL https://raw.githubusercontent.com/rgreinho/tfe-cli/master/extras/tfe-cli-installer.sh)For Windows, download the binary from the release page.
TFE_TOKEN: Terraform Enterprise API tokenTFE_ORG: Terraform Enterprise organizationTFE_LOG_LEVEL: Logging level (valid values aredebug,info,warn,error,fatal,panic)TFE_ADDRESS: Terraform Enterprise API addressTFE_BASEPATH: Base path on which the Terraform Enterprise API is served.
Some of these values can also be specified on the command line. In this case, the environment variables are ignored.
By default, tfe-cli does not display anything if a command succeeds (unless a result
is expected, like listing the workspaces for instance). The verbosity can be adjusted
by setting the log level accordingly.
Manage workspaces for an organization.
Create a new TFE workspace.
The format of the VCS option is string of colon sperated values: <OAuthTokenID>:<repository>:<branch>.
Create a new workspace with default values:
tfe-cli workspace create my-new-workspaceSetup the VCS Repository:
tfe-cli workspace create my-new-workspace --vcsrepository ot-8Xc1NTYpjIQZIwIh:organization/repository:masterDelete an exisiting workspace.
tfe-cli workspace delete my-new-workspaceList existing workspaces in the organization.
tfe-cli workspace listManage variables for a workspace.
Create a new variable into a specific workspace:
tfe-cli variable create exisiting-workspace --var akey=a_valueUpdate an existing variable in a specific workspace:
tfe-cli variable create my-exisiting-workspace -f --var akey=another_valueWhen creating/updating variables, several of them of can be specified at the same time:
tfe-cli variable create my-exisiting-workspace \
--var akey=a_value \
--svar bkey=b_secure_value \
--hvar hclkey=hcl_value \
--var-file stage.tfvars \Delete a variable:
tfe-cli variable delete my-workspace backend_portList exisitng variables for a specific workspace.
List variables:
tfe-cli variable list my-workspaceList TFE notifications for a specific workspace.
tfe-cli notification list my-workspaceCreates or update a notification.
Create a Slack notification for the created and errored events:
tfe-cli notification create my-workspace \
my-notification \
--type slack \
--url https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX \
--triggers run:created \
--triggers run:erroredDeletes a notification by its name, in a specific workspace.
tfe-cli notification delete my-workspace my-notification