ci: update aws asg resource selector (#1991)

* update resource selector

* tidy

* fix shellcheck

* bazel tidy
This commit is contained in:
Moritz Sanft 2023-07-10 11:13:37 +02:00 committed by GitHub
parent d3ad46f727
commit 184530a80d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,18 +7,29 @@ shopt -s inherit_errexit
echo "Using AWS region: ${1}" echo "Using AWS region: ${1}"
# TODO(msanft): Remove once 2.9.0 is released
CP_SELECTOR="module.instance_group_control_plane"
W_SELECTOR="module.instance_group_worker_nodes"
if [[ $(./constellation version) != *"2.8.0"* ]]; then
echo "Constellation version is not 2.8.0, using updated ASG selectors"
CP_SELECTOR='module.instance_group["control_plane_default"]'
W_SELECTOR='module.instance_group["worker_default"]'
fi
pushd constellation-terraform pushd constellation-terraform
controlAutoscalingGroup=$( controlAutoscalingGroup=$(
terraform show -json | terraform show -json |
jq -r .'values.root_module.child_modules[] | jq --arg selector "$CP_SELECTOR" \
select(.address == "module.instance_group_control_plane") | -r .'values.root_module.child_modules[] |
.resources[0].values.name' select(.address == $selector) |
.resources[0].values.name'
) )
workerAutoscalingGroup=$( workerAutoscalingGroup=$(
terraform show -json | terraform show -json |
jq -r .'values.root_module.child_modules[] | jq --arg selector "$W_SELECTOR" \
select(.address == "module.instance_group_worker_nodes") | -r .'values.root_module.child_modules[] |
.resources[0].values.name' select(.address == $selector) |
.resources[0].values.name'
) )
popd popd