provider/aws: Refresh `aws_cloudwatch_event_target` from state on `ResourceNotFoundException` (#8442)

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

Fixes #6928

@radeksimko FYI :)

* Update resource_aws_cloudwatch_event_target.go
This commit is contained in:
Paul Stack 2016-08-24 13:02:48 +01:00 committed by GitHub
parent fbda254401
commit 50556c58b8
1 changed files with 7 additions and 0 deletions

View File

@ -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
}