Skip to content

terraform apply of large TypeSet is slow, assertSetValuesCompatible is too complex #32940

@freedge

Description

@freedge

Terraform Version

Terraform v1.5.0-dev
on linux_amd64

Terraform Configuration Files

per https://github.com/PaloAltoNetworks/terraform-provider-panos/blob/b4ad451eb47b2c7e463d94b13fd7e2a5a62db158/docs/resources/address_objects.md

# 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

for ai, av := range as {
for bi, bv := range bs {
if f(av, bv) {

complexity is N^2

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions