Merge pull request #7712 from hashicorp/fix_7699

test for length of ami tags before tagging
This commit is contained in:
Adrien Delorme 2019-06-04 10:17:43 +02:00 committed by GitHub
commit 2d12af0b48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 6 deletions

View File

@ -105,12 +105,16 @@ func (s *StepCreateTags) Run(ctx context.Context, state multistep.StateBag) mult
RetryDelay: (&retry.Backoff{InitialBackoff: 200 * time.Millisecond, MaxBackoff: 30, Multiplier: 2}).Linear, RetryDelay: (&retry.Backoff{InitialBackoff: 200 * time.Millisecond, MaxBackoff: 30, Multiplier: 2}).Linear,
}.Run(ctx, func(ctx context.Context) error { }.Run(ctx, func(ctx context.Context) error {
// Tag images and snapshots // Tag images and snapshots
_, err := regionConn.CreateTags(&ec2.CreateTagsInput{
Resources: resourceIds, var err error
Tags: amiTags, if len(amiTags) > 0 {
}) _, err = regionConn.CreateTags(&ec2.CreateTagsInput{
if err != nil { Resources: resourceIds,
return err Tags: amiTags,
})
if err != nil {
return err
}
} }
// Override tags on snapshots // Override tags on snapshots