mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-08 15:13:56 -06:00
provider/aws: Retry deletion of AWSConfig Rule on ResourceInUseException (#14269)
This commit is contained in:
parent
e88ca0b744
commit
b3eefecc05
@ -242,8 +242,17 @@ func resourceAwsConfigConfigRuleDelete(d *schema.ResourceData, meta interface{})
|
||||
name := d.Get("name").(string)
|
||||
|
||||
log.Printf("[DEBUG] Deleting AWS Config config rule %q", name)
|
||||
_, err := conn.DeleteConfigRule(&configservice.DeleteConfigRuleInput{
|
||||
ConfigRuleName: aws.String(name),
|
||||
err := resource.Retry(2*time.Minute, func() *resource.RetryError {
|
||||
_, err := conn.DeleteConfigRule(&configservice.DeleteConfigRuleInput{
|
||||
ConfigRuleName: aws.String(name),
|
||||
})
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "ResourceInUseException" {
|
||||
return resource.RetryableError(err)
|
||||
}
|
||||
return resource.NonRetryableError(err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Deleting Config Rule failed: %s", err)
|
||||
|
Loading…
Reference in New Issue
Block a user