diff --git a/builtin/providers/aws/resource_aws_cloudwatch_event_target.go b/builtin/providers/aws/resource_aws_cloudwatch_event_target.go index 727a17192..a64221f60 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_event_target.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_event_target.go @@ -61,9 +61,6 @@ func resourceAwsCloudWatchEventTargetCreate(d *schema.ResourceData, meta interfa rule := d.Get("rule").(string) targetId := d.Get("target_id").(string) - id := rule + "-" + targetId - d.SetId(id) - input := buildPutTargetInputStruct(d) log.Printf("[DEBUG] Creating CloudWatch Event Target: %s", input) out, err := conn.PutTargets(input) @@ -76,6 +73,9 @@ func resourceAwsCloudWatchEventTargetCreate(d *schema.ResourceData, meta interfa out.FailedEntries) } + id := rule + "-" + targetId + d.SetId(id) + log.Printf("[INFO] CloudWatch Event Target %q created", d.Id()) return resourceAwsCloudWatchEventTargetRead(d, meta)