Skip to content

Commit

Permalink
provider/aws: Refresh aws_cloudwatch_event_target from state on `Re…
Browse files Browse the repository at this point in the history
…sourceNotFoundException` (hashicorp#8442)

* provider/aws: Refresh `aws_cloudwatch_event_target` from state on
`ResourceNotFoundException`

Fixes hashicorp#6928

@radeksimko FYI :)

* Update resource_aws_cloudwatch_event_target.go
  • Loading branch information
stack72 authored and Richard Bowden committed Aug 27, 2016
1 parent c4e5f6b commit 7fbf64b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions builtin/providers/aws/resource_aws_cloudwatch_event_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ func resourceAwsCloudWatchEventTargetRead(d *schema.ResourceData, meta interface
d.SetId("")
return nil
}

if awsErr.Code() == "ResourceNotFoundException" {
log.Printf("[WARN] CloudWatch Event Target (%q) not found. Removing it from state.", d.Id())
d.SetId("")
return nil
}

}
return err
}
Expand Down

0 comments on commit 7fbf64b

Please sign in to comment.