diff --git a/execution/utility.sh b/execution/utility.sh index 9bbcaa93..f6114e4e 100755 --- a/execution/utility.sh +++ b/execution/utility.sh @@ -2476,15 +2476,19 @@ function get_rds_hostname() { function check_rds_snapshot_username() { local region="$1"; shift + local db_type="$1"; shift local db_snapshot_identifier="$1"; shift local expected_username="$1"; shift info "Checking snapshot username matches expected username" - snapshot_info="$(aws --region ${region} rds describe-db-snapshots --include-shared --include-public --db-snapshot-identifier ${db_snapshot_identifier} || return $? )" + if [[ "${db_type}" == "cluster" ]]; then + snapshot_username="$( aws --region ${region} rds describe-db-cluster-snapshots --include-shared --include-public --db-cluster-snapshot-identifier --output text --query 'DBClusterSnapshots[0].MasterUsername || ``' || return $? )" + else + snapshot_username="$(aws --region ${region} rds describe-db-snapshots --include-shared --include-public --db-snapshot-identifier ${db_snapshot_identifier} --output text --query 'DBSnapshots[0].MasterUsername || ``' || return $? )" + fi if [[ -n "${snapshot_info}" ]]; then - snapshot_username="$( echo "${snapshot_info}" | jq -r '.DBSnapshots[0].MasterUsername' )" if [[ "${snapshot_username}" != "${expected_username}" ]]; then