You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I can run terraform init -backend-config=<path> [dir] that allows me to separate the local state/backend config vars from the terraform provisioning scripts (including partial backend config).
However I cannot use terraform workspaces with this configuration as (I believe) it currently requires the state/backend config vars to be in the same directory as the terraform scripts. If I do use terraform workspace new it will give the error:
Backend reinitialization required..
Reason: Unsetting the previously set backend..
Attempted Solutions
I've explore available environment variables but there doesn't seem to be any global way to set additional backend-config. Also I think the optional directory for terraform scripts should be explicitly added to the command itself.
Other commands such as terraform state allow state to exist in another directory via: terraform state <subcommand> -state <path>, however this option is already used to copy old state to a new workspace, and it also may not work considering workspaces are using multiple state files.
Many commands support optional directory for terraform scripts, which may be easiest to implement for the workspace commands: e.g. terraform plan <scripts_dir>.
Proposal
Add the -backend-config and/or optional scripts directory to terraform workspace commands to allow separation of state/config: terraform workspace new -backend-config <path> [dir]
References
The text was updated successfully, but these errors were encountered:
benfortuna
changed the title
Suppport -backend-config with terraform workspace commands
Suppport -backend-config and/or optional script dir with terraform workspace commands
Aug 22, 2019
hashibot
added
cli
v0.12
Issues (primarily bugs) reported against v0.12 releases
and removed
v0.12
Issues (primarily bugs) reported against v0.12 releases
labels
Aug 22, 2019
Current Terraform Version
Use-cases
Currently I can run
terraform init -backend-config=<path> [dir]
that allows me to separate the local state/backend config vars from the terraform provisioning scripts (including partial backend config).However I cannot use terraform workspaces with this configuration as (I believe) it currently requires the state/backend config vars to be in the same directory as the terraform scripts. If I do use
terraform workspace new
it will give the error:Attempted Solutions
I've explore available environment variables but there doesn't seem to be any global way to set additional backend-config. Also I think the optional directory for terraform scripts should be explicitly added to the command itself.
Other commands such as terraform state allow state to exist in another directory via:
terraform state <subcommand> -state <path>
, however this option is already used to copy old state to a new workspace, and it also may not work considering workspaces are using multiple state files.Many commands support optional directory for terraform scripts, which may be easiest to implement for the workspace commands: e.g.
terraform plan <scripts_dir>
.Proposal
Add the
-backend-config
and/or optional scripts directory to terraform workspace commands to allow separation of state/config:terraform workspace new -backend-config <path> [dir]
References
The text was updated successfully, but these errors were encountered: