Can we implement a way to restrict next steps from executing if in current step there are No Updates in AWS stack? If there are updates, then let is function normally by calling next steps, but if there is no change in stack due to deployment, then I would like to prevent next steps from executing.
Please can someone advise on this?
Hi @pratik.surani, thanks for reaching out.
To determine if a CloudFormation template will result in any changes you’ll have to do some custom scripting.
create-change-set command (https://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-change-set.html) can be used in a
Run an AWS CLI Script step to create a CloudFormation change set.
describe-change-set command (https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-change-set.html) can then be used to find out if there are in fact any changes that need to be applied.
The output of the
describe-change-set command can then be used to set a variable (https://octopus.com/docs/deployment-process/variables/output-variables) which is then used as part of a run condition (https://octopus.com/docs/deployment-process/conditions#run-condition) to determine if subsequent steps should be processed.
If there are changes to be applied, you can use the
Apply an AWS CloudFormation Change Set step to apply the changes and continue on with any other deployment steps.