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
{{ message }}
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.
This leads to the side effect, that the AMI is created with packer using the random awsRegion and terraform infrastructure rollout is using the pre-configured AWS_DEFAULT_REGION.
I am a bit confused since the region is configured for terraform as well:
The problem seems to be this line in the terratest code.
It reads the environment variables from the current execution context. In this case the AWS_DEFAULT_REGION is configured twice.
Solution
The following possibilities to tackle the issue come to my mind:
Avoid using data "aws_region" "current" {} and inject the region using a variable.
Changing the behavior of terratest to ignore default region.
Rewriting the tests to use with the default region configured.
Document the issue and warn about the use of default region
Hard to tell which one is the most suitable solution. Currently I am more leaning towards option 4.
Would be happy to support independent of the option.
The text was updated successfully, but these errors were encountered:
Hm, are you saying that environment variables defined in your terminal are overriding the environment variables defined in the EnvVars param of terraform.Options?
Summary
Using an AWS default region configured in the terminal context breaks randomized AWS region selection.
Problem Analysis
Using
references to the
AWS_DEFAULT_REGION
configured in the current terminal context, if one is configured.The tests are written in a way to randomize the region selection, e.g.
.
This leads to the side effect, that the AMI is created with packer using the random
awsRegion
and terraform infrastructure rollout is using the pre-configuredAWS_DEFAULT_REGION
.I am a bit confused since the region is configured for terraform as well:
The problem seems to be this line in the terratest code.
It reads the environment variables from the current execution context. In this case the
AWS_DEFAULT_REGION
is configured twice.Solution
The following possibilities to tackle the issue come to my mind:
data "aws_region" "current" {}
and inject the region using a variable.Hard to tell which one is the most suitable solution. Currently I am more leaning towards option 4.
Would be happy to support independent of the option.
The text was updated successfully, but these errors were encountered: