cloud/awscloud: handle nil describe output when creating LTs/SGs
This commit is contained in:
parent
fa3b203178
commit
e30fba38fc
1 changed files with 17 additions and 13 deletions
|
|
@ -294,15 +294,17 @@ func (a *AWS) createOrReplaceSG(hostInstanceID, hostIP, vpcID string) (string, e
|
||||||
if err != nil && !isInvalidGroupNotFoundErr(err) {
|
if err != nil && !isInvalidGroupNotFoundErr(err) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
for _, sg := range descrSGOutput.SecurityGroups {
|
if descrSGOutput != nil {
|
||||||
_, err := a.ec2.DeleteSecurityGroup(
|
for _, sg := range descrSGOutput.SecurityGroups {
|
||||||
context.Background(),
|
_, err := a.ec2.DeleteSecurityGroup(
|
||||||
&ec2.DeleteSecurityGroupInput{
|
context.Background(),
|
||||||
GroupId: sg.GroupId,
|
&ec2.DeleteSecurityGroupInput{
|
||||||
},
|
GroupId: sg.GroupId,
|
||||||
)
|
},
|
||||||
if err != nil {
|
)
|
||||||
return "", err
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,7 +386,12 @@ func (a *AWS) createOrReplaceLT(hostInstanceID, imageID, sgID, iamProfile, keyNa
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if len(descrLTOutput.LaunchTemplates) == 1 {
|
|
||||||
|
if err != nil && !isLaunchTemplateNotFoundError(err) {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
if descrLTOutput != nil && len(descrLTOutput.LaunchTemplates) == 1 {
|
||||||
_, err := a.ec2.DeleteLaunchTemplate(
|
_, err := a.ec2.DeleteLaunchTemplate(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
&ec2.DeleteLaunchTemplateInput{
|
&ec2.DeleteLaunchTemplateInput{
|
||||||
|
|
@ -395,9 +402,6 @@ func (a *AWS) createOrReplaceLT(hostInstanceID, imageID, sgID, iamProfile, keyNa
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil && !isLaunchTemplateNotFoundError(err) {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
input := &ec2.CreateLaunchTemplateInput{
|
input := &ec2.CreateLaunchTemplateInput{
|
||||||
LaunchTemplateData: &ec2types.RequestLaunchTemplateData{
|
LaunchTemplateData: &ec2types.RequestLaunchTemplateData{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue