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
F3332721: D12959.id43201.diff
Thu, Nov 21, 1:15 AM
F3332692: D12959.id43206.diff
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
Unknown Object (File)
Oct 20 2024, 3:37 PM
Unknown Object (File)
Oct 19 2024, 8:24 AM
Unknown Object (File)
Oct 18 2024, 9:45 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