Skip to content

Commit

Permalink
Tagging on PUT only works when creating a rule
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Oct 20, 2020
1 parent eb058e1 commit 32b2eea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions aws/resource_aws_cloudwatch_event_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func resourceAwsCloudWatchEventRuleCreate(d *schema.ResourceData, meta interface
if err != nil {
return fmt.Errorf("Creating CloudWatch Events Rule failed: %w", err)
}

if v, ok := d.GetOk("tags"); ok {
input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().CloudwatcheventsTags()
}

log.Printf("[DEBUG] Creating CloudWatch Events Rule: %s", input)

// IAM Roles take some time to propagate
Expand Down Expand Up @@ -303,10 +308,6 @@ func buildPutRuleInputStruct(d *schema.ResourceData, name string) (*events.PutRu
}
}

if v, ok := d.GetOk("tags"); ok {
input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().CloudwatcheventsTags()
}

input.State = aws.String(getStringStateFromBoolean(d.Get("is_enabled").(bool)))

return &input, nil
Expand Down

0 comments on commit 32b2eea

Please sign in to comment.