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

fix: fix data race in schema merging logic by creating a copy instead of modifying the original struct instance #397

Merged
merged 1 commit into from
Jun 5, 2024

Commits on Jun 5, 2024

  1. fix: fix data race in schema merging logic by creating a copy instead…

    … of modifying the original struct instance
    
    Different jobs in terraform-ls use the same `hcl.Block` instance simultaneously and the schema merger modified it in the past.
    We fixed this by creating a copy first which uncovered another bug: The `buildDynamicBlockSchema` function implicitly read
    that change from the dependent schema, which we fixed by reading from the `mergedSchema` instead. This in turn required us
    to also pass the dependent schema into the function as the `mergedSchema` also contains the static `lifecycle` block which
    can't be set via a dynamic block. This means we now iterate over all blocks in the dependent schema but copy their bodies
    from the `mergedSchema`.
    ansgarm committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    e29c68b View commit details
    Browse the repository at this point in the history