provider/aws: Retry ECS svc creation on ClusterNotFoundException (#15066)
This commit is contained in:
parent
9000f2fc31
commit
f24396b904
|
@ -222,8 +222,7 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error
|
||||||
|
|
||||||
log.Printf("[DEBUG] Creating ECS service: %s", input)
|
log.Printf("[DEBUG] Creating ECS service: %s", input)
|
||||||
|
|
||||||
// Retry due to AWS IAM policy eventual consistency
|
// Retry due to AWS IAM & ECS eventual consistency
|
||||||
// See https://github.com/hashicorp/terraform/issues/2869
|
|
||||||
var out *ecs.CreateServiceOutput
|
var out *ecs.CreateServiceOutput
|
||||||
var err error
|
var err error
|
||||||
err = resource.Retry(2*time.Minute, func() *resource.RetryError {
|
err = resource.Retry(2*time.Minute, func() *resource.RetryError {
|
||||||
|
@ -239,6 +238,11 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error
|
||||||
awsErr.Message())
|
awsErr.Message())
|
||||||
return resource.RetryableError(err)
|
return resource.RetryableError(err)
|
||||||
}
|
}
|
||||||
|
if awsErr.Code() == "ClusterNotFoundException" {
|
||||||
|
log.Printf("[DEBUG] Trying to create ECS service again: %q",
|
||||||
|
awsErr.Message())
|
||||||
|
return resource.RetryableError(err)
|
||||||
|
}
|
||||||
|
|
||||||
return resource.NonRetryableError(err)
|
return resource.NonRetryableError(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue