From 1ce2cd40d31f3400384ee9cdd690fdb454ba7d4c Mon Sep 17 00:00:00 2001 From: snowiow Date: Wed, 12 Jun 2024 15:56:49 +0200 Subject: [PATCH] delete empty changesets --- cloudformation.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cloudformation.go b/cloudformation.go index debed4b..dc9a1ca 100644 --- a/cloudformation.go +++ b/cloudformation.go @@ -210,7 +210,15 @@ func (c *Cloudformation) CloudFormationDeploy(templateBody string, namedIAM bool } if changeSetIsEmpty(dcso) { - c.logger().Infof("ChangeSet '%v' is empty. Nothing to do.", *ccso.Id) + c.logger().Infof("ChangeSet '%v' is empty. Deleting again.", *ccso.Id) + + _, err3 := c.CFClient.DeleteChangeSet(&cloudformation.DeleteChangeSetInput{ + ChangeSetName: aws.String(csn), + StackName: aws.String(sn), + }) + if err3 != nil { + return fmt.Errorf("Couldn't delete empty change set: %w", err3) + } return nil }