terraform-provider-google: google_project_iam_member is slow when upgrading >= v3.14
When upgrading the google provider I noticed one of the workflow I am working one takes a lot longer to execute.
Not even the actual deployment phase, just the terraform plan.
The “refreshing state” step took ~10 minutes before and now it takes 3 hours.
I probed the different versions available and found out that this issue started for v3.14
I have reduced this issue to a single component google_project_iam_member, to make things easier to talk about and reproduce.
This is a list of ~100 members to deploy in iam.
With v3.13, terraform plan takes <1 min to execute
with v3.14 and higher, terraform plan takes 8 minutes to execute.
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
- Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
- If an issue is assigned to the
modular-magicianuser, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot, a community member has claimed the issue already.
Terraform Version
Terraform v0.12.28
- provider.google v3.38.0
Affected Resource(s)
- google_project_iam_member
Terraform Configuration Files
resource "google_project_iam_member" "project_members" {
count = "${length(var.members)}"
project = "${var.project}"
role = "roles/browser"
member = "${element(var.members, count.index)}"
}
Debug Output
https://gist.github.com/FrancoisPoinsot/07f597e7d3e5aef3705b31114e4b0b23
Expected Behavior
terraform plan would take <1 minute to execute
Actual Behavior
terraform plan takes 8 minutes to execute
Steps to Reproduce
- create a var
membersof ~100 members - actually deploy them
- execute
terraform plan
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 20 (4 by maintainers)
I suspect https://github.com/hashicorp/terraform-provider-google/pull/5902 may have introduced this performance regression and will verify tomorrow.
I ran a small test:
time terraform planrepeated the last 2 step until I can plot a graph repeated the whole process with v3.13 and v3.14. Ok I did not plot all the point of 3.14 because I just did not want to wait the whole morning in front of my screen.
Here are the results:
Reminder, my test project is still this only resource:
It looks to me there is an issue with how v3.14 (and higher) scales with the state size.