Commit 4a01539d authored by Jerome Touffe-Blin's avatar Jerome Touffe-Blin

Fix #17647 - AWS add tag to SG only if existing tag

parent 147b6911
...@@ -1552,6 +1552,7 @@ func (s *AWSCloud) ensureSecurityGroup(name string, description string, vpcID st ...@@ -1552,6 +1552,7 @@ func (s *AWSCloud) ensureSecurityGroup(name string, description string, vpcID st
tags = append(tags, tag) tags = append(tags, tag)
} }
if len(tags) > 0 {
tagRequest := &ec2.CreateTagsInput{} tagRequest := &ec2.CreateTagsInput{}
tagRequest.Resources = []*string{&groupID} tagRequest.Resources = []*string{&groupID}
tagRequest.Tags = tags tagRequest.Tags = tags
...@@ -1559,6 +1560,7 @@ func (s *AWSCloud) ensureSecurityGroup(name string, description string, vpcID st ...@@ -1559,6 +1560,7 @@ func (s *AWSCloud) ensureSecurityGroup(name string, description string, vpcID st
// Not clear how to recover fully from this; we're OK because we don't match on tags, but that is a little odd // Not clear how to recover fully from this; we're OK because we don't match on tags, but that is a little odd
return "", fmt.Errorf("error tagging security group: %v", err) return "", fmt.Errorf("error tagging security group: %v", err)
} }
}
return groupID, nil return groupID, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment