mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Fix: Do not store ID of CW Event Target if creation fails
This commit is contained in:
parent
1448b84b37
commit
5a786d52d9
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user