Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validation Error: no updates are to be performed in Cloudformation returns error

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?

like image 668
Mazzy Avatar asked Jan 08 '18 12:01

Mazzy


2 Answers

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
like image 111
Zoran Majstorovic Avatar answered Oct 20 '22 13:10

Zoran Majstorovic


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

like image 41
Kiran N Avatar answered Oct 20 '22 14:10

Kiran N