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

[WIP] provider/aws: 60s instance profile creation retry #11634

Closed

Conversation

snakeb1t
Copy link
Contributor

@snakeb1t snakeb1t commented Feb 2, 2017

fixes #9474

@catsby
Copy link
Contributor

catsby commented Feb 2, 2017

I think that if we need to ensure an instance profile is created, we should do so in the instance profile creation

I think line #123 would be a perfect place to use the AWS SDK's IAM waiter:

What do you think?

@snakeb1t
Copy link
Contributor Author

snakeb1t commented Feb 2, 2017

@catsby : whoa, that's really neat! I'll give it a try. Though I wonder if there's a race condition here: suppose we keep trying the GetInstanceProfile until it succeeds, but then terraform moves on to creating a resource that relied on the instance profile resource (say, an EC2 instance). But when terraform tries to make that resource, the EC2 service's equivalent of GetInstanceProfile still returns nothing when it tries to make the resource, so the resource fails.

Even though there might not be any guarantees, using the Waiter would still be way better (and a general fix) than what we have now. KMS keys can't be created if any principal listed in its policy doesn't exist (from the perspective of the KMS service), so my original PR wouldn't do anything about that.

Thanks so much; I'll push something up soon.

@snakeb1t snakeb1t changed the title provider/aws: 60s instance profile creation retry [WIP] provider/aws: 60s instance profile creation retry Feb 2, 2017
@catsby
Copy link
Contributor

catsby commented Feb 2, 2017

but then terraform moves on to creating a resource that relied on the instance profile resource (say, an EC2 instance).

If we're waiting in the instance_profile then anything that depends on it should be themselves waiting. Assuming they are related correctly with interpolation in the config files, Terraform ensures that A comes before B.

Unfortunately IAM does sometime, seemingly, tell us directly that resource A is ready, but when trying to create resource B, resource B's service ask's IAM for A and IAM says it 'doesn't know what we're talking about 😄

@catsby
Copy link
Contributor

catsby commented Feb 2, 2017

I'm going to close this for now as we discussed I'm not sure this is the right fix. Please reopen (ping me if you can't) or open a new PR if/when the time comes. Thanks!

@catsby catsby closed this Feb 2, 2017
snakeb1t pushed a commit to snakeb1t/terraform that referenced this pull request Feb 3, 2017
catsby pushed a commit that referenced this pull request Feb 6, 2017
arcadiatea pushed a commit to ticketmaster/terraform that referenced this pull request Feb 9, 2017
@ghost
Copy link

ghost commented Apr 17, 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 17, 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.

IAM instance profile attachment race condition
2 participants