When I execute in my CI aws-cli to update CloudFormation stack, I get the following error message:
An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed.
No updates are seen like error hence the CI fails. Any idea how to capture this error?
Unfortunately, command aws cloudformation update-stack
does not have an option:
--no-fail-on-empty-changeset
but, perhaps, something like this could work:
#!/bin/bash
output=$(aws cloudformation update-stack --stack-name foo 2>&1)
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "$output"
else
if [[ "$output" == *"No updates are to be performed"* ]]; then
echo "No cloudformation updates are to be performed."
exit 0
else
echo "$output"
exit $RESULT
fi
fi
use --no-fail-on-empty-changeset
along with your aws cli command.
eg:
aws cloudformation deploy --template-file ${TEMPLATE_FILE_PATH} --stack-name ${CF_STACK_NAME} --parameter-overrides ${PARAMETER_OVERRIDES} --no-fail-on-empty-changeset
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With