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

Make eventually-consistent resources poll on create/update #4993

Open
spew opened this issue Nov 25, 2019 · 6 comments
Open

Make eventually-consistent resources poll on create/update #4993

spew opened this issue Nov 25, 2019 · 6 comments

Comments

@spew
Copy link
Contributor

spew commented Nov 25, 2019

Description

After a successful CREATE or UPDATE the terraform provider immediately does a GET on the same resource. This creates problems when the resource is eventually consistent as the GET may fetch the old state. Especially so for UPDATEs. Many services which have eventually consistent resources, return a copy of the resource in the response. Rather than GET the resource, the provider could use the response to alleviate some of the issues.

New or Affected Resource(s)

google_iam_policy
google
_iam_member
google_pubsub_subscription

References

  • #0000
@chrisst
Copy link
Contributor

chrisst commented Jan 8, 2020

@spew do you have a good example to repro this or a debug log from when this was causing a diff it shouldn't have? I played around with a couple of the resources you noted but haven't seen one where the update succeed but resulted in the state being set incorrectly.

@rileykarson
Copy link
Collaborator

https://gist.github.com/kibbles-n-bytes/3d2bb8a76c856354f65ff50cfc72cc44 is a terraform-less repro of the pubsub one

@spew
Copy link
Contributor Author

spew commented Jan 9, 2020

It's eventually consistent so you won't expect to see it often -- I'd say it happens 1/50 times or so for iam_service_account (which isn't listed). Not sure about frequency of policy.

@spew
Copy link
Contributor Author

spew commented Jan 9, 2020

Yes, the pubsub example is better.

@chrisst
Copy link
Contributor

chrisst commented Jan 9, 2020

I think this would require changing these resources to no longer call into Read after create/update in order to accomplish this. Naturally any subsequent refresh phase will still call into read so it can't completely solve the issue.
We could alternatively add polling for transitions of individual field values to ensure that an update has fully succeeded, but that would require a medium sized overhaul of the resource as well.

Given that the behavior of state setting in the future is still in question (see #4328) I won't be taking this on right now.

@chrisst chrisst removed their assignment Jan 9, 2020
@danawillow danawillow added this to the Backlog milestone Jan 13, 2020
@emilymye emilymye changed the title Use server Response as Apply(...) result instead of fetching new Make eventually-consistent resources poll on create/update Jan 27, 2020
@emilymye emilymye modified the milestones: Backlog, Sprint 5 Jan 27, 2020
@emilymye emilymye self-assigned this Jan 27, 2020
@c2thorn c2thorn modified the milestones: Sprint 5, Sprint 6 Feb 10, 2020
@danawillow danawillow modified the milestones: Sprint 6, Near-Term Goals Feb 10, 2020
@emilymye emilymye removed this from the Near-Term Goals milestone Feb 13, 2020
@emilymye emilymye added this to the Sprint 6 milestone Feb 13, 2020
@emilymye emilymye modified the milestones: Sprint 6, Sprint 7 Mar 2, 2020
@danawillow danawillow modified the milestones: Sprint 7, Near-Term Goals Mar 9, 2020
@emilymye
Copy link
Contributor

emilymye commented Mar 9, 2020

GoogleCloudPlatform/magic-modules#3155 added the ability to poll post create/update for PubSub and generic utils. We've moved this this near-term goals so we can track adding additional polling in other resources as we find them.

@emilymye emilymye removed their assignment Jun 17, 2020
@emilymye emilymye modified the milestones: Near-Term Goals, Goals Jun 17, 2020
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Aug 3, 2021
…icorp#4993)

Co-authored-by: upodroid <cy@borg.dev>
Co-authored-by: Cameron Thornton <camthornton@google.com>
Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit that referenced this issue Aug 3, 2021
… (#9716)

Co-authored-by: upodroid <cy@borg.dev>
Co-authored-by: Cameron Thornton <camthornton@google.com>
Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: upodroid <cy@borg.dev>
Co-authored-by: Cameron Thornton <camthornton@google.com>
@github-actions github-actions bot added forward/review In review; remove label to forward service/pubsub labels Aug 17, 2023
@ScottSuarez ScottSuarez added service/terraform and removed forward/review In review; remove label to forward service/pubsub labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants