Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #13538 #14020

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions aws/resource_aws_eks_fargate_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func resourceAwsEksFargateProfileCreate(d *schema.ResourceData, meta interface{}
input.Tags = keyvaluetags.New(v).IgnoreAws().EksTags()
}

err := resource.Retry(2*time.Minute, func() *resource.RetryError {
// Creation of profiles must be serialized, and can take a while, increase the timeout to a long time.
err := resource.Retry(30*time.Minute, func() *resource.RetryError {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the mutex handles the timing issue -- going to revert this back to the 2 minute IAM propagation timeout.

_, err := conn.CreateFargateProfile(input)

// Retry for IAM eventual consistency on error:
Expand All @@ -119,6 +120,11 @@ func resourceAwsEksFargateProfileCreate(d *schema.ResourceData, meta interface{}
return resource.RetryableError(err)
}

// Retry for ResourceInUse errors, creation needs to be serialized.
if isAWSErr(err, eks.ErrCodeResourceInUseException, "") {
return resource.RetryableError(err)
}

if err != nil {
return resource.NonRetryableError(err)
}
Expand Down Expand Up @@ -232,14 +238,25 @@ func resourceAwsEksFargateProfileDelete(d *schema.ResourceData, meta interface{}
FargateProfileName: aws.String(fargateProfileName),
}

_, err = conn.DeleteFargateProfile(input)
// Deletion of profiles must be serialized, and can take a while, increase the timeout to a long time.
err = resource.Retry(30*time.Minute, func() *resource.RetryError {
_, err := conn.DeleteFargateProfile(input)
// Retry for ResourceInUse errors, creation needs to be serialized.
if isAWSErr(err, eks.ErrCodeResourceInUseException, "") {
return resource.RetryableError(err)
}
if err != nil {
return resource.NonRetryableError(err)
}
return nil
})

if isAWSErr(err, eks.ErrCodeResourceNotFoundException, "") {
return nil
}

if err != nil {
return fmt.Errorf("error deleting EKS Fargate Profile (%s): %s", d.Id(), err)
return fmt.Errorf("error Deleting EKS Fargate Profile (%s): %s", d.Id(), err)
}

if err := waitForEksFargateProfileDeletion(conn, clusterName, fargateProfileName, d.Timeout(schema.TimeoutDelete)); err != nil {
Expand Down