Skip to content

Commit abee87b

Browse files
fix: pass ess_region in terraform destroy
1 parent 99a6800 commit abee87b

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

.buildkite/scripts/steps/ess.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ function ess_up {
4040
}
4141

4242
function ess_down {
43+
param (
44+
[string]$EssRegion = "gcp-us-west2"
45+
)
4346
$Workspace = & git rev-parse --show-toplevel
4447
$TfDir = Join-Path -Path $Workspace -ChildPath "test_infra/ess/"
4548
$stateFilePath = Join-Path -Path $TfDir -ChildPath "terraform.tfstate"
@@ -52,7 +55,8 @@ function ess_down {
5255
try {
5356
Push-Location -Path $TfDir
5457
& terraform init
55-
& terraform destroy -auto-approve
58+
& terraform destroy -auto-approve `
59+
-var="ess_region=$EssRegion"
5660
Pop-Location
5761
} catch {
5862
Write-Output "Error: Failed to destroy ESS stack(it will be auto-deleted later): $_"

.buildkite/scripts/steps/ess.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ function ess_up() {
4040
}
4141

4242
function ess_down() {
43-
echo "~~~ Tearing down the ESS Stack"
43+
echo "~~~ Tearing down the ESS Stack"
44+
local ESS_REGION=${1:-"gcp-us-west2"}
4445
local WORKSPACE=$(git rev-parse --show-toplevel)
4546
local TF_DIR="${WORKSPACE}/test_infra/ess/"
4647

4748
pushd "${TF_DIR}"
4849
terraform init
49-
terraform destroy -auto-approve
50+
terraform destroy -auto-approve \
51+
-var="ess_region=${ESS_REGION}"
5052
popd
5153
}
5254

.buildkite/scripts/steps/ess_down.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ set -euo pipefail
33

44
source .buildkite/scripts/steps/ess.sh
55

6-
ess_down
6+
ESS_REGION="${ESS_REGION:-gcp-us-west2}"
7+
8+
ess_down "$ESS_REGION"

0 commit comments

Comments
 (0)