-
Notifications
You must be signed in to change notification settings - Fork 60
Description
When bootstrapping for the first time, it's possible to get into a state where the S3 state bucket when initially created has the correct name but is placed in the wrong region.
When the region is specified via -r <region> the expectation is that this is honoured throughout all areas of the bootstrap.
However, if you have a different region specified in any of the .tfvars file within etc (such as global.tfvars) the S3 bootstrapping bucket ends up associated to this region, not the region that was specified by -r flag.
I would have the expectation that the -r flag overrides any other regions it adopts from .tfvars as an explicit value and overrides any picked up through vars.
The bucket is placed in the expected region if the -r value and any it finds in .tfvars matches up
Tested in version:
- v1.7.0
Steps to reproduce:
- Edit
./etc/global.tfvarsand amend the value forregiontoregion = eu-west-1 - Run bootstrapping command
./bin/terraform.sh --bootstrap -r us-east-1 -p myproject -a plan
Expected:
- S3 bucket for storing state is created in the region specified by
-r-us-east-1
Actual:
- S3 bucket for storing state is created in the region specified in
.tfvarsfiles picked up in the project -eu-west-1 - S3 bucket name created does however have the expected name ending in
us-east-1