GitHub Actions for applying a variable set to a workspace in Terraform Cloud
With this action you can apply a variable set to a workspace in Terraform Cloud as part of your GitHub Actions workflows.
This action should be preceded by the mattias-fjellstrom/tfc-setup action to configure required environment variables. See the sample below.
You are required to provide the name of the variable set as a parameter named variable_set under with: for this action.
You have to specify organization and workspace as input to this action, either as with: parameters or through environment variables using the mattias-fjellstrom/tfc-setup action.
Sample workflow
Below is a full sample workflow that sets up a new workspace in Terraform Cloud when a pull-request is opened and applies a variable set named cloud-credentials to the workspace, and deletes the workspace once the pull-request is closed. If the pull request is opened for a branch named feature-1 the resulting workspace will be named my-workspace-feature-1 in this sample.