@@ -49,7 +49,7 @@ func NewService(i cloudformationiface.CloudFormationAPI) *Service {
49
49
}
50
50
51
51
// ReconcileBootstrapStack creates or updates bootstrap CloudFormation.
52
- func (s * Service ) ReconcileBootstrapStack (stackName string , t go_cfn.Template , tags map [string ]string , deleteOnFailure bool ) error {
52
+ func (s * Service ) ReconcileBootstrapStack (stackName string , t go_cfn.Template , tags map [string ]string ) error {
53
53
yaml , err := t .YAML ()
54
54
processedYaml := string (yaml )
55
55
if err != nil {
@@ -64,7 +64,7 @@ func (s *Service) ReconcileBootstrapStack(stackName string, t go_cfn.Template, t
64
64
})
65
65
}
66
66
//nolint:nestif
67
- if err := s .createStack (stackName , processedYaml , stackTags , deleteOnFailure ); err != nil {
67
+ if err := s .createStack (stackName , processedYaml , stackTags ); err != nil {
68
68
if code , _ := awserrors .Code (errors .Cause (err )); code == "AlreadyExistsException" {
69
69
klog .Infof ("AWS Cloudformation stack %q already exists, updating" , klog .KRef ("" , stackName ))
70
70
updateErr := s .updateStack (stackName , processedYaml , stackTags )
@@ -97,29 +97,26 @@ func (s *Service) ReconcileBootstrapNoUpdate(stackName string, t go_cfn.Template
97
97
})
98
98
}
99
99
//nolint:nestif
100
- if err := s .createStack (stackName , processedYaml , stackTags , true ); err != nil {
100
+ if err := s .createStack (stackName , processedYaml , stackTags ); err != nil {
101
101
if code , _ := awserrors .Code (errors .Cause (err )); code == "AlreadyExistsException" {
102
102
desInput := & cfn.DescribeStacksInput {StackName : aws .String (stackName )}
103
103
if err := s .CFN .WaitUntilStackCreateComplete (desInput ); err != nil {
104
104
return errors .Wrap (err , "failed to wait for AWS CloudFormation stack to be CreateComplete" )
105
105
}
106
106
return nil
107
107
}
108
- return err
108
+ return fmt . Errorf ( "failed to create CF stack: %w" , err )
109
109
}
110
110
return nil
111
111
}
112
112
113
- func (s * Service ) createStack (stackName , yaml string , tags []* cfn.Tag , deleteOnFailure bool ) error {
113
+ func (s * Service ) createStack (stackName , yaml string , tags []* cfn.Tag ) error {
114
114
input := & cfn.CreateStackInput {
115
115
Capabilities : aws .StringSlice ([]string {cfn .CapabilityCapabilityIam , cfn .CapabilityCapabilityNamedIam }),
116
116
TemplateBody : aws .String (yaml ),
117
117
StackName : aws .String (stackName ),
118
118
Tags : tags ,
119
119
}
120
- if deleteOnFailure {
121
- input .OnFailure = aws .String (cfn .OnFailureDelete )
122
- }
123
120
klog .V (2 ).Infof ("creating AWS CloudFormation stack %q" , stackName )
124
121
if _ , err := s .CFN .CreateStack (input ); err != nil {
125
122
return errors .Wrap (err , "failed to create AWS CloudFormation stack" )
0 commit comments