i just got a snapshot from what apparentlymart wrote
- Run
terraform initlocally against that configuration to configure the backend. That should reach out to the Terraform Cloud API and verify that the given organization exists and that your credentials grant access to it. - Run
terraform workspace listto see the local workspaces that correspond to the remote workspaces you created in the first step. If you use the names I gave as examples, you’d see workspaces namedstageandprod. - Return to the Terraform Cloud UI and configure the environment-specific variables for each of the
networking-workspace using the variable management UI. (You can also manage these in Terraform using thetfeprovider, but I won’t get into the details of that here for brevity.) - In your local shell, run
terraform workspace select stageto select the staging workspace. You can runterraform applyhere to push your current configuration up to the remotenetworking-stageworkspace and run Terraform using the variables you configured for that specific workspace. - Similarly, run
terraform workspace select prodto select the production workspace. Again, runterraform applyto push up the configuration and run Terraform with the separate workspace-specific variables for production.
from how-do-i-pass-var-file-on-teffaform-cloud
theterraform.tfvarsfile isn’t used in Terraform Cloud, because Terraform Cloud actually overwrites that file with the variables you configured in the web UI, in order to make those variable values available to the Terraform run.
If you rename that file to something ending in.auto.tfvarsthen it should work. For example, you could rename it toterraform.auto.tfvars..auto.tfvarsfiles take precedence overterraform.tfvars, which means that in the Terraform Cloud context values set in.auto.tfvarswill override a value provided via the Variables web UI in Terraform Cloud (because Terraform Cloud writes those intoterraform.tfvars).