Open clemlesne opened 3 years ago
Hi @instagendleg 👋 Thank you for submitting this and sorry you ran into trouble here. The Terraform S3 Backend code is currently part of the upstream Terraform CLI codebase so any issue discussions and potential bug fixes would need to occur there with those familiar with that functionality. I will go ahead and transfer this issue.
Hi,
I founded two workarounds to this bug:
key
parameter to what I wished to have with workspace_key_prefix
, so backends-infra-[workspace]-default.tfstate
. This can be automatized.default
as your workspace name. Using default
remove the behavior or workspace_key_prefix
. After multiple tests, I renamed my defaults workspaces to standard
. Could it be possible for you to specify this properly in the doc?I'm still seeing this issue in terraform 1.0.9.
This issue is preventing me from using the same s3 bucket to store multiple terraform repos or groups of state files. I want to be able to break up my infrastructure into products but store the states for each product in the same bucket.
For GCS, this is possible using the prefix
key so I am not sure why it's not possible for AWS.
[prefix](https://www.terraform.io/language/settings/backends/gcs#prefix) - (Optional) GCS prefix inside the bucket. Named states for workspaces are stored in an object called <prefix>/<name>.tfstate.
Ref: https://www.terraform.io/language/settings/backends/gcs
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Main configuration:
CLI command:
Envs:
Debug Output
https://gist.github.com/instagendleg/2fdc89b09c6165d391e0db27e9c25be8
Expected Behavior
I defined my
workspace_key_prefix
backend prefix equals tobackends/infra
and mykey
name equals todefault
, my AWS S3 file should be of type/backends/infra/[workspace]/default
.Actual Behavior
Instead of, my backend is written at the path
/default
.Steps to Reproduce
terraform apply