Skip to content

Commit 37ea112

Browse files
authored
Merge pull request #703 from amznhonnold/cfstack-termination-protection-matcher
fix(cloudformation): improve termination protection message matching
2 parents 10cfa3b + c94e305 commit 37ea112

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

resources/cloudformation-stack.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ func (r *CloudFormationStack) removeWithAttempts(ctx context.Context, attempt in
188188
*r.Name, attempt, r.maxDeleteAttempts)
189189
return err
190190
}
191-
} else if awsErr.Message() == fmt.Sprintf("Stack [%s] cannot be deleted while TerminationProtection is enabled", *r.Name) {
191+
} else if strings.Contains(awsErr.Message(), "cannot be deleted while TerminationProtection is enabled") &&
192+
strings.Contains(awsErr.Message(), *r.Name) {
192193
// check if the setting for the resource is set to allow deletion protection to be disabled
193194
if r.settings.GetBool("DisableDeletionProtection") {
194195
r.logger.Infof("CloudFormationStack stackName=%s attempt=%d maxAttempts=%d updating termination protection",

0 commit comments

Comments
 (0)