-
Notifications
You must be signed in to change notification settings - Fork 10.3k
terraform apply of large TypeSet is slow, assertSetValuesCompatible is too complex #32940
Copy link
Copy link
Closed
Description
Terraform Version
Terraform v1.5.0-dev
on linux_amd64Terraform Configuration Files
# Make address objects like "test1_1", "test1_2", ...
resource "panos_address_objects" "example" {
dynamic "object" {
for_each = setproduct(range(1, 6), range(1, 11))
content {
name = "test${object.value[0]}_${object.value[1]}"
type = "ip-netmask"
value = "10.${object.value[0]}.${object.value[1]}.0/24"
}
}
lifecycle {
create_before_destroy = true
}
}Debug Output
...
2023-03-29T10:59:27.846+0200 [TRACE] checkPlannedChange: Verifying that actual change (action Update) matches planned change (action Update)
...
Expected Behavior
terraform apply should be reasonably fast when applying object with large schema.TypeSet (8k objects)
Actual Behavior
terraform apply is terribly slow
Steps to Reproduce
unfortunately https://github.com/hashicorp/terraform-provider-null does not use schema.TypeSet so I don't know how to provide a reproducer
Additional Context
terraform/internal/plans/objchange/compatible.go
Lines 347 to 349 in d9dfd45
| for ai, av := range as { | |
| for bi, bv := range bs { | |
| if f(av, bv) { |
complexity is N^2
References
Reactions are currently unavailable