-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to set block values in terraform init -backend-config=...
#21830
Comments
terraform init -backend-config=...
terraform init -backend-config=...
Thanks for reporting this, @lawliet89. Indeed, before this worked as an accidental consequence of how Terraform was using HCL, and no longer works because I think we'll need to investigate a little deeper to see what is feasible as a response here. We might be able to address this by having the In the meantime, passing this option via a file on disk would be the workaround, since an HCL file for backend config can use all of the HCL syntax features natively. However, I expect that generating a temporary file like that will not be convenient for terragrunt; generating a file on disk happens to how Terraform Cloud and Terraform Enterprise handle this situation, but they have more control over the execution environment than terragrunt tends to, given that terragrunt can be used directly as a CLI tool. |
Ran into this issue as well, I was able to use a disk file to specify the workspace, but spent time trying to get the workspaces=[{name=foo}] syntax working before I found this GitHub Issue. Until this can be resolved, would it make sense to add a note to the documentation at: https://www.terraform.io/docs/backends/config.html#partial-configuration to indicate that not being able to set the workspace name/prefix from the command line using -backend-config is a known limitation? |
+1 for this, will definitely help with generating repository-based dynamic workspaces with Terraform Cloud! |
Also encountered this for Terratest. A documentation update would have been useful. Like @jfpanisset I also spent some hours trying to work this out. |
We need to be able to pass variables on terraform init. This is critical. We can't specify a file with sensitive information. |
This is critical. The testing and production should be using different workspaces, so their names has to be dynamic |
Same here. Any ETA on a fix / workaround? |
@chenjianjx @tovbinm |
This really needs to be fixed! |
I spent a day trying to figure out proper solution, until I found this thread. |
Hi all! Sorry for the long silence here. I think this issue got a bit neglected because the "remote" backend has subsequently been replaced by the native Terraform Cloud settings, which achieve a similar result but using a first-class For the configurations shown in the initial issue report, the equivalent settings for the Terraform Cloud integration would be as follows: terraform {
required_version = ">= 1.1.0"
cloud {
# (normally settings would go here, but I'm going to show
# how to set them via environment variables instead below)
}
}
There's some more detailed migration information in Migrating from the There's more information on the environment variables that can substitute for the settings in the The I've done my best to give a general overview of the new capabilities here, but if you have a situation that I haven't considered in this comment please contact HashiCorp Support for help with your specific situation. Thanks for reporting this, and sorry again for the long silence. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform Version
Terraform Configuration Files
Expected Behavior
Consider the usage of the Terraform
remote
backend where configuration values are provided via the CLI.Previously, in Terraform 0.11, I could do
I was able to set the values for the
workspaces
block for theremote
backend via-backend-config
CLI flag duringterraform init
.Actual Behavior
Steps to Reproduce
Additional Context
This change in behaviour is probably due to the commit which added validation against the
Attributes
of backend schemas only and does not bother withBlockTypes
. As far as I could tell, there was no validation previously and the value was passed to the backend directly for deserialization.This will affect gruntwork-io/terragrunt#687.
The text was updated successfully, but these errors were encountered: