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)
Sat, Sep 7, 1:46 PM
Unknown Object (File)
Sat, Sep 7, 1:44 PM
Unknown Object (File)
Thu, Sep 5, 11:17 PM
Unknown Object (File)
Thu, Sep 5, 4:59 PM
Unknown Object (File)
Thu, Sep 5, 4:52 PM
Unknown Object (File)
Thu, Sep 5, 4:51 PM
Unknown Object (File)
Thu, Sep 5, 4:51 PM
Unknown Object (File)
Wed, Aug 28, 11:21 PM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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