diff --git a/builtin/providers/aws/resource_aws_ecs_service.go b/builtin/providers/aws/resource_aws_ecs_service.go index 107f7c188..121e43997 100644 --- a/builtin/providers/aws/resource_aws_ecs_service.go +++ b/builtin/providers/aws/resource_aws_ecs_service.go @@ -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) }