provider/aws: Retry ECS svc creation on ClusterNotFoundException (#15066)

This commit is contained in:
Radek Simko 2017-06-05 09:50:23 +01:00 committed by GitHub
parent 9000f2fc31
commit f24396b904
1 changed files with 6 additions and 2 deletions

View File

@ -222,8 +222,7 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error
log.Printf("[DEBUG] Creating ECS service: %s", input)
// Retry due to AWS IAM policy eventual consistency
// See https://github.com/hashicorp/terraform/issues/2869
// Retry due to AWS IAM & ECS eventual consistency
var out *ecs.CreateServiceOutput
var err error
err = resource.Retry(2*time.Minute, func() *resource.RetryError {
@ -239,6 +238,11 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error
awsErr.Message())
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)
}