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
F3343520: D12959.id43201.diff
Fri, Nov 22, 2:57 AM
F3343075: D12959.id43056.diff
Fri, Nov 22, 2:30 AM
F3339901: D12959.diff
Thu, Nov 21, 9:03 PM
Unknown Object (File)
Thu, Nov 21, 1:15 AM
Unknown Object (File)
Thu, Nov 21, 1:14 AM
Unknown Object (File)
Sat, Nov 16, 9:37 PM
Unknown Object (File)
Sun, Nov 10, 5:47 PM
Unknown Object (File)
Sun, Nov 10, 9:27 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
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