Problem
A workspace configured to use dynamic credentials with multiple provider configurations is erroring with a message similar to the following:
Error: No value for required variable
│
│ on main.tf line 24:
│ 24: variable "tfc_vault_backed_aws_dynamic_credentials" {
│
│ The root module input variable "tfc_vault_backed_aws_dynamic_credentials"
│ is not set, and has no default value. Use a -var or -var-file command line
│ argument to provide a value for this variable.
╵
Operation failed: failed running terraform plan (exit 1)
Note: The error may be slightly different depending on which provider you are using and whether you are using vault-backed dynamic credentials.
Cause
There are a few potentials causes for this error.
- Your version of Terraform Enterprise does not have the functionality to support dynamic credentials with multiple provider configurations. Support for dynamic credentials with multiple provider configurations was added in Terraform Enterprise v202308-1.
- You are using self-hosted Terraform Cloud Agents on a version that does not support dynamic credentials with multiple provider configurations. Support for dynamic credentials with multiple provider configurations was added in agent v1.12.0.
- The workspace's environment variables are configured incorrectly to use dynamic credentials.
Overview of possible solutions
Since there are multiple causes, please attempt the following solutions:
Solutions:
-
(Only applicable to Terraform Enterprise (TFE)) If you are on a release older than Terraform Enterprise v202308-1, reach out to your Platform team and request the environment be upgraded to an appropriate release.
- (Only applicable to Terraform Cloud (TFC)) If you are on an agent version lower than v1.12.0, reach out to your Platform team and request agent version 1.12.0 or greater be used.
- If you are on a supported TFE/Agent version, review the required environment variables on the workspace here and add any missing environment variables.
Outcome:
After following the steps above, dynamic credentials with multiple provider configurations should work. If you encounter issues after trying the solutions above, please reach out to HashiCorp Support for assistance.
Additional Information
References
Terraform Enterprise Release Notes (v202308-1)
Dynamic Credentials - Specifying Multiple Configurations