Page MenuHomePhabricator

[terraform] Adds aws region export to aws-deploy.sh script
ClosedPublic

Authored by will on Aug 4 2024, 7:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 20, 3:37 PM
Unknown Object (File)
Sat, Oct 19, 8:24 AM
Unknown Object (File)
Fri, Oct 18, 9:45 PM
Unknown Object (File)
Fri, Oct 18, 9:45 PM
Unknown Object (File)
Fri, Oct 18, 9:45 PM
Unknown Object (File)
Oct 8 2024, 11:57 AM
Unknown Object (File)
Oct 7 2024, 2:00 PM
Unknown Object (File)
Oct 7 2024, 3:36 AM
Subscribers

Details

Summary

Ashoat ran into an issue of having a different aws region configured through aws-cli when running aws-deploy which prevented the migrations from running.

We should ensure the script properly sets the region so the user will always be able to run the script

Depends on D12930

Test Plan

I deployed my self-host setup to us-east-1. Through aws configure, I set the region to us-east-2 and ensured the aws-cli region was set by using aws-cli to
describe the keyserver cluster which resulted in a non-existent cluster. However, the script works properly, demonstrating that the script was able to properly
set the region to us-east-1

Diff Detail

Repository
rCOMM Comm
Branch
keyserver_to_aws_1
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

will requested review of this revision.Aug 4 2024, 7:35 PM

Accepting because according to your test plan, it worked. It should work as long as aws-cli-v2 is used because it supports AWS_DEFAULT_REGION.

But be aware that AWS_REGION env takes precedence over AWS_DEFAULT_REGION in the CLI and generally the former should be used. This script will fail if somebody sets AWS_REGION to something else.

More context: https://stackoverflow.com/a/75670789 and https://docs.aws.amazon.com/sdkref/latest/guide/feature-region.html
It's unfortunate that SO has better explanation than official docs ¯\_(ツ)_/¯

This revision is now accepted and ready to land.Aug 5 2024, 2:41 AM

Accepting because according to your test plan, it worked. It should work as long as aws-cli-v2 is used because it supports AWS_DEFAULT_REGION.

But be aware that AWS_REGION env takes precedence over AWS_DEFAULT_REGION in the CLI and generally the former should be used. This script will fail if somebody sets AWS_REGION to something else.

More context: https://stackoverflow.com/a/75670789 and https://docs.aws.amazon.com/sdkref/latest/guide/feature-region.html
It's unfortunate that SO has better explanation than official docs ¯\_(ツ)_/¯

To clarify then, we should be exporting AWS_REGION then right? I can do a test

In D12959#367023, @will wrote:

To clarify then, we should be exporting AWS_REGION then right? I can do a test

Yeah I think it's safer

review feedback AWS_DEFAULT_REGION to AWS_REGION