-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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`.
- Loading branch information
Showing
2 changed files
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters