What does this pull request do?
When a new AWS Provider needs to be created or an AWS session needs to be established, aws.Config needs to contain the correct region for interactions with AWS to work.
In the case where l0 instances are initialized and set up in a region other than the default us-west-2, the resources will create in the region specified in the init wizard, but pushing terraform state to the S3 bucket fails because it was always assumed that the AWS region would be us-west-2.
To fix this, anytime an AWS Provider is needed, the instance derives what region it's in (assuming that l0-setup apply ran to completion), and then passes that region into the AWS Provider helper function so that aws.Config sets the correct region for API operations via the WithRegion() method.
The cli flag --aws-region is now no longer required in any l0-setup operation. The region the user specifies in l0-setup init is going to be the region used for AWS Provider operations through l0-setup
How should this be tested?
Unit tests, making a new l0 instance in a region other than us-west-2. l0-setup apply should correctly push terraform state to the bucket after apply. l0-setup push and l0-setup pull should also work.
What does this pull request do? When a new AWS Provider needs to be created or an AWS session needs to be established, aws.Config needs to contain the correct region for interactions with AWS to work.
In the case where l0 instances are initialized and set up in a region other than the default us-west-2, the resources will create in the region specified in the init wizard, but pushing terraform state to the S3 bucket fails because it was always assumed that the AWS region would be us-west-2.
To fix this, anytime an AWS Provider is needed, the instance derives what region it's in (assuming that l0-setup apply ran to completion), and then passes that region into the AWS Provider helper function so that aws.Config sets the correct region for API operations via the WithRegion() method.
The cli flag
--aws-region
is now no longer required in any l0-setup operation. The region the user specifies inl0-setup init
is going to be the region used for AWS Provider operations throughl0-setup
How should this be tested? Unit tests, making a new l0 instance in a region other than us-west-2.
l0-setup apply
should correctly push terraform state to the bucket after apply.l0-setup push
andl0-setup pull
should also work.Checklist
closes #444