Skip to content
Snippets Groups Projects
Commit 922c57c8 authored by Gabriel Féron's avatar Gabriel Féron
Browse files

Apply review suggestions

parent d90c3347
No related branches found
No related tags found
No related merge requests found
...@@ -884,7 +884,7 @@ func (d *Driver) getEbsVolumeId() (string, error) { ...@@ -884,7 +884,7 @@ func (d *Driver) getEbsVolumeId() (string, error) {
} }
if len(inst.BlockDeviceMappings) == 0 || inst.BlockDeviceMappings[0].Ebs == nil { if len(inst.BlockDeviceMappings) == 0 || inst.BlockDeviceMappings[0].Ebs == nil {
return "", err return "", nil
} }
return *inst.BlockDeviceMappings[0].Ebs.VolumeId, nil return *inst.BlockDeviceMappings[0].Ebs.VolumeId, nil
...@@ -1104,17 +1104,8 @@ func (d *Driver) configureTags(tagGroups string) error { ...@@ -1104,17 +1104,8 @@ func (d *Driver) configureTags(tagGroups string) error {
} }
} }
volumeId, err := d.getEbsVolumeId() _, err := d.getClient().CreateTags(&ec2.CreateTagsInput{
resources := []*string{} Resources: d.getTagResources(),
if err != nil {
log.Warnf("failed to get EBS volume ID: %s", err)
resources = []*string{&d.InstanceId}
} else {
resources = []*string{&d.InstanceId, &volumeId}
}
_, err = d.getClient().CreateTags(&ec2.CreateTagsInput{
Resources: resources,
Tags: tags, Tags: tags,
}) })
...@@ -1125,6 +1116,19 @@ func (d *Driver) configureTags(tagGroups string) error { ...@@ -1125,6 +1116,19 @@ func (d *Driver) configureTags(tagGroups string) error {
return nil return nil
} }
func (d *Driver) getTagResources() []*string {
resources := []*string{&d.InstanceId}
volumeId, err := d.getEbsVolumeId()
if err != nil {
log.Warnf("failed to get EBS volume ID: %s", err)
return resources
}
return append(resources, &volumeId)
}
func (d *Driver) configureSecurityGroups(groupNames []string) error { func (d *Driver) configureSecurityGroups(groupNames []string) error {
if len(groupNames) == 0 { if len(groupNames) == 0 {
log.Debugf("no security groups to configure in %s", d.VpcId) log.Debugf("no security groups to configure in %s", d.VpcId)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment