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}"
# 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
controlAutoscalingGroup=$(
terraform show -json |
jq -r .'values.root_module.child_modules[] |
select(.address == "module.instance_group_control_plane") |
.resources[0].values.name'
jq --arg selector "$CP_SELECTOR" \
-r .'values.root_module.child_modules[] |
select(.address == $selector) |
.resources[0].values.name'
)
workerAutoscalingGroup=$(
terraform show -json |
jq -r .'values.root_module.child_modules[] |
select(.address == "module.instance_group_worker_nodes") |
.resources[0].values.name'
jq --arg selector "$W_SELECTOR" \
-r .'values.root_module.child_modules[] |
select(.address == $selector) |
.resources[0].values.name'
)
popd