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

adds resource retry to SpotInstanceRequestCreate #8516

Merged

Conversation

richardbowden
Copy link
Contributor

Fixes #8426

so that the create process waits for IAM Instance profiles and roles to propagate before continuing, this has been taken from resource_aws_instance

so that the create process waits for IAM Instance profiles and roles to propagate before continuing, this has been taken from `resource_aws_instance`
return resource.RetryableError(err)
}
// IAM roles can also take time to propagate in AWS:
if isAWSErr(err, "InvalidParameterValue", " has no associated IAM Roles") {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would keep this simple here, since you are not doing anything special with the InvalidParameterValue specific message, besides logging, that is. You could simply check for it, then log a message that there was an error, and use err.Message() (need to assert right type, though) and then return resource.RetryableError(err) as usual.

@richardbowden
Copy link
Contributor Author

Hello @kwilczynski, not sure I understand what you mean ? my reasoning for this is that the code should retry on the two specific error messages of "has no associated IAM Roles" and "Invalid IAM Instance Profile" with any other error that could occur would not be retried. To Keep things consistent with other parts of the code base, this was copied from the aws_instance resource.

https://github.com/hashicorp/terraform/blob/master/builtin/providers/aws/resource_aws_instance.go#L369

@kwilczynski
Copy link
Contributor

@richardbowden fair enough, given that the original implementation does this too. I wish AWS reported certain errors differently. Sorry!

@stack72
Copy link
Contributor

stack72 commented Aug 29, 2016

Hi @richardbowden

this LGTM! The tests are green:

% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSpotInstanceRequest_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/08/29 21:42:11 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSpotInstanceRequest_ -timeout 120m
=== RUN   TestAccAWSSpotInstanceRequest_basic
--- PASS: TestAccAWSSpotInstanceRequest_basic (112.38s)
=== RUN   TestAccAWSSpotInstanceRequest_withBlockDuration
--- PASS: TestAccAWSSpotInstanceRequest_withBlockDuration (221.40s)
=== RUN   TestAccAWSSpotInstanceRequest_vpc
--- PASS: TestAccAWSSpotInstanceRequest_vpc (138.64s)
=== RUN   TestAccAWSSpotInstanceRequest_SubnetAndSG
--- PASS: TestAccAWSSpotInstanceRequest_SubnetAndSG (143.85s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    616.285s

Thanks so much for all the work here :)

Paul

@stack72 stack72 merged commit b673f4d into hashicorp:master Aug 29, 2016
@richardbowden richardbowden deleted the spot-request-with-iam-profile branch August 31, 2016 08:50
@ghost
Copy link

ghost commented Apr 22, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spot instance request fails with Invalid IAM Instance Profile name
3 participants