diff --git a/aws/resource_aws_spot_fleet_request.go b/aws/resource_aws_spot_fleet_request.go index f47146c7b5e..a3b5cabe689 100644 --- a/aws/resource_aws_spot_fleet_request.go +++ b/aws/resource_aws_spot_fleet_request.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsSpotFleetRequest() *schema.Resource { @@ -950,19 +951,18 @@ func resourceAwsSpotFleetRequestCreate(d *schema.ResourceData, meta interface{}) // Since IAM is eventually consistent, we retry creation as a newly created role may not // take effect immediately, resulting in an InvalidSpotFleetRequestConfig error var resp *ec2.RequestSpotFleetOutput - err := resource.Retry(10*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.RequestSpotFleet(spotFleetOpts) - if isAWSErr(err, "InvalidSpotFleetRequestConfig", "Duplicate: Parameter combination") { - return resource.NonRetryableError(fmt.Errorf("Error creating Spot fleet request: %s", err)) - } - if isAWSErr(err, "InvalidSpotFleetRequestConfig", "") { - return resource.RetryableError(fmt.Errorf("Error creating Spot fleet request, retrying: %s", err)) + if isAWSErr(err, "InvalidSpotFleetRequestConfig", "Parameter: SpotFleetRequestConfig.IamFleetRole is invalid") { + return resource.RetryableError(err) } + if err != nil { return resource.NonRetryableError(err) } + return nil })