Skip to content

Performance issues with blocktoattr.ExpandedVariables and Block.DecoderSpec #25889

@jbardin

Description

@jbardin

Resources with large, deeply nested schemas can cause blocktoattr.ExpandedVariables to take a relatively large amount of time to execute.

For example, the aws_wafv2_web_acl which has a combined total of 2878 blocks at the moment, takes many seconds to process the potential references from the configuration.

There are 2 pieces that may need to be optimized here:

  • The blocktoattr.ExpandedVariables calls schema.DecoderSpec() for each block as it recurses through the schema, but schema.DecoderSpec() is also recursive and re-evaluates each child block even though the result is only used for the current level of recursion.

  • The schema.DecoderSpec() call itself is relatively slow, taking ~1s for the top-level call on aws_wafv2_web_acl with my test machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfirmeda Terraform Core team member has reproduced this issuecoreperformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions