File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -582,12 +582,14 @@ func (c *StackCollection) DeleteStackBySpec(ctx context.Context, s *Stack) (*Sta
582582 fmt .Sprintf ("%s:%s" , api .ClusterNameTag , c .spec .Metadata .Name ))
583583 }
584584
585- updateTerminationProtectionInput := & cloudformation.UpdateTerminationProtectionInput {
586- StackName : s .StackId ,
587- EnableTerminationProtection : aws .Bool (false ),
588- }
589- if _ , err := c .cloudformationAPI .UpdateTerminationProtection (ctx , updateTerminationProtectionInput ); err != nil {
590- return nil , fmt .Errorf ("disabling termination protection on stack %q: %w" , * s .StackName , err )
585+ if s .EnableTerminationProtection != nil && * s .EnableTerminationProtection {
586+ updateTerminationProtectionInput := & cloudformation.UpdateTerminationProtectionInput {
587+ StackName : s .StackId ,
588+ EnableTerminationProtection : aws .Bool (false ),
589+ }
590+ if _ , err := c .cloudformationAPI .UpdateTerminationProtection (ctx , updateTerminationProtectionInput ); err != nil {
591+ return nil , fmt .Errorf ("disabling termination protection on stack %q: %w" , * s .StackName , err )
592+ }
591593 }
592594
593595 input := & cloudformation.DeleteStackInput {
You can’t perform that action at this time.
0 commit comments