From d158a59d1aedf9cf2e47d60b89fadd8e7ee5be56 Mon Sep 17 00:00:00 2001 From: Gamunu Balagalla Date: Wed, 11 Sep 2024 21:17:48 +0530 Subject: [PATCH 1/5] feat: use opentofu schema and opentofu registry Purpose of this change to ensure the schema defintions are pulled from the opentofu registry over terraform registry. Initial changes are working but the schema library is not avaiable as a shared lib hence the fork gamunu/opentofu-schema Signed-off-by: Gamunu Balagalla --- .changes/v0.33.1.md | 1276 ----------------- .changes/v0.33.2.md | 24 - .changes/v0.33.3.md | 11 - .changes/v0.34.0-alpha20240611.md | 15 - .changes/v0.34.0-beta1.md | 6 - .changes/v0.34.0.md | 16 - go.mod | 17 +- go.sum | 34 +- .../features/modules/decoder/decoder_test.go | 2 +- .../features/modules/decoder/functions.go | 4 +- .../features/modules/decoder/module_schema.go | 4 +- .../features/modules/decoder/path_reader.go | 8 +- .../validations/unreferenced_origin.go | 2 +- internal/features/modules/events.go | 4 +- .../features/modules/hooks/module_version.go | 4 +- .../modules/hooks/module_version_test.go | 4 +- internal/features/modules/jobs/metadata.go | 6 +- internal/features/modules/jobs/schema.go | 6 +- .../modules/jobs/schema_mock_responses.go | 2 +- internal/features/modules/jobs/schema_test.go | 4 +- .../features/modules/jobs/validation_test.go | 2 +- internal/features/modules/modules_feature.go | 4 +- .../features/modules/state/module_metadata.go | 6 +- .../features/modules/state/module_store.go | 8 +- .../features/modules/state/module_test.go | 4 +- .../rootmodules/jobs/lockfile_test.go | 2 +- internal/features/rootmodules/jobs/schema.go | 4 +- .../features/rootmodules/jobs/schema_test.go | 4 +- internal/features/rootmodules/jobs/version.go | 2 +- .../rootmodules/root_modules_feature.go | 4 +- .../rootmodules/state/installed_providers.go | 2 +- .../features/rootmodules/state/root_store.go | 4 +- .../features/rootmodules/state/root_test.go | 2 +- .../features/stacks/decoder/path_reader.go | 2 +- .../features/variables/decoder/path_reader.go | 2 +- .../variables/decoder/variable_context.go | 2 +- .../variables/jobs/validation_test.go | 2 +- .../handlers/command/module_calls.go | 4 +- .../handlers/command/module_calls_test.go | 4 +- .../handlers/command/module_providers.go | 2 +- .../handlers/did_change_watched_files_test.go | 2 +- .../execute_command_module_providers_test.go | 4 +- .../execute_command_terraform_version_test.go | 4 +- internal/lsp/semantic_tokens.go | 2 +- internal/registry/module.go | 2 +- internal/registry/module_test.go | 2 +- internal/schemas/gen/gen.go | 2 +- internal/schemas/schemas.go | 2 +- internal/state/installed_providers.go | 2 +- internal/state/provider_ids.go | 2 +- internal/state/provider_schema.go | 4 +- internal/state/provider_schema_test.go | 4 +- internal/state/registry_modules.go | 4 +- internal/state/registry_modules_test.go | 4 +- internal/terraform/datadir/module_manifest.go | 2 +- .../terraform/datadir/module_manifest_test.go | 2 +- .../datadir/module_manifest_unix_test.go | 2 +- .../datadir/module_manifest_windows_test.go | 2 +- .../terraform/datadir/plugin_lock_file.go | 2 +- .../datadir/plugin_lock_file_test.go | 2 +- main.go | 2 +- version.go | 2 +- 62 files changed, 115 insertions(+), 1456 deletions(-) delete mode 100644 .changes/v0.33.1.md delete mode 100644 .changes/v0.33.2.md delete mode 100644 .changes/v0.33.3.md delete mode 100644 .changes/v0.34.0-alpha20240611.md delete mode 100644 .changes/v0.34.0-beta1.md delete mode 100644 .changes/v0.34.0.md diff --git a/.changes/v0.33.1.md b/.changes/v0.33.1.md deleted file mode 100644 index 5ec0015d7..000000000 --- a/.changes/v0.33.1.md +++ /dev/null @@ -1,1276 +0,0 @@ -## 0.33.1 (22 April 2024) - -ENHANCEMENTS: - -* Rename TFC to HCP Terraform in documentation ([#1687](https://github.com/hashicorp/terraform-ls/pull/1687)) -* Rename TFC to HCP Terraform in hover documentation ([terraform-schema#1687](https://github.com/hashicorp/terraform-schema/pull/343)) - -INTERNAL: - -* Remove token from delete-artifact action ([#1685](https://github.com/hashicorp/terraform-ls/pull/1685)) -* Revert "Use Terraform 1.8-rc1 for bundling schemas (#1669)" ([#1686](https://github.com/hashicorp/terraform-ls/pull/1686)) - -## 0.33.0 (10 April 2024) - -ENHANCEMENTS: - -* Support for provider-defined functions ([#1636](https://github.com/hashicorp/terraform-ls/pull/1636)) -* Remove `use_legacy_workflow` from S3 backend ([terraform-schema#338](https://github.com/hashicorp/terraform-schema/pull/338)) -* Add `issensitive` function ([terraform-schema#340](https://github.com/hashicorp/terraform-schema/pull/340)) -* Conclude `module_variable_optional_attrs` language experiment ([terraform-schema#337](https://github.com/hashicorp/terraform-schema/pull/337)) - -BUG FIXES: - -* Only merge provider-defined functions for Terraform >= 1.8 ([#1672](https://github.com/hashicorp/terraform-ls/pull/1672), [terraform-schema#336](https://github.com/hashicorp/terraform-schema/pull/336)) - -INTERNAL: - -* Use Terraform `1.8.0-rc1` for bundling schemas ([#1669](https://github.com/hashicorp/terraform-ls/pull/1669)) -* Update net package (updates some more alongside) ([#1677](https://github.com/hashicorp/terraform-ls/pull/1677)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.42.0 to 2.42.2 ([#1662](https://github.com/hashicorp/terraform-ls/pull/1662), [#1680](https://github.com/hashicorp/terraform-ls/pull/1680)) -* build(deps): Bump github.com/zclconf/go-cty from 1.14.3 to 1.14.4 ([#1666](https://github.com/hashicorp/terraform-ls/pull/1666)) -* build(deps): Bump workflows to latest trusted versions ([#1673](https://github.com/hashicorp/terraform-ls/pull/1673)) -* build(deps): Bump golang.org/x/tools from 0.19.0 to 0.20.0 ([#1679](https://github.com/hashicorp/terraform-ls/pull/1679)) -* build(deps): Bump github.com/creachadair/jrpc2 from 1.1.2 to 1.2.0 ([#1674](https://github.com/hashicorp/terraform-ls/pull/1674)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.6.3 to 0.6.4 ([#1675](https://github.com/hashicorp/terraform-ls/pull/1675)) -* build(deps): Bump go.opentelemetry.io/otel/trace from 1.24.0 to 1.25.0 ([#1678](https://github.com/hashicorp/terraform-ls/pull/1678)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.49.0 to 0.50.0 ([#1681](https://github.com/hashicorp/terraform-ls/pull/1681)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.49.0 to 0.50.0 ([#1682](https://github.com/hashicorp/terraform-ls/pull/1682)) - -## 0.33.0-beta2 (27 March 2024) - -ENHANCEMENTS: - -* Support for provider-defined functions ([#1636](https://github.com/hashicorp/terraform-ls/pull/1636)) - -INTERNAL: - -* Use Terraform `1.8.0-rc1` for bundling schemas ([#1669](https://github.com/hashicorp/terraform-ls/pull/1669)) - -## 0.32.8 (11 March 2024) - -NOTES / BREAKING CHANGES: - -* Remove `inspect-module` command ([#1642](https://github.com/hashicorp/terraform-ls/pull/1642)) - -BUG FIXES: - -* Fix `for` expression collection constraints ([hcl-lang#375](https://github.com/hashicorp/hcl-lang/pull/375)) - -INTERNAL: - -* Remove getting provider schema log line ([#1643](https://github.com/hashicorp/terraform-ls/pull/1643)) -* Ignore preloaded schemas in complex module test ([#1638](https://github.com/hashicorp/terraform-ls/pull/1638)) -* Remove outdated LSP comparison from README ([#1641](https://github.com/hashicorp/terraform-ls/pull/1641)) -* Link to `.github/CONTRIBUTING.md` in README ([#1635](https://github.com/hashicorp/terraform-ls/pull/1635)) -* Bump Go version ([#1649](https://github.com/hashicorp/terraform-ls/pull/1649)) -* Enable pre releases via CRT ([#1651](https://github.com/hashicorp/terraform-ls/pull/1651)) -* build(deps): Bump workflows to latest trusted versions ([#1605](https://github.com/hashicorp/terraform-ls/pull/1605), [#1639](https://github.com/hashicorp/terraform-ls/pull/1639), [#1656](https://github.com/hashicorp/terraform-ls/pull/1656), [#1659](https://github.com/hashicorp/terraform-ls/pull/1659)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.40.3 to 2.42.0 ([#1633](https://github.com/hashicorp/terraform-ls/pull/1633), [#1640](https://github.com/hashicorp/terraform-ls/pull/1640)) -* build(deps): Bump golang.org/x/tools from 0.17.0 to 0.19.0 ([#1634](https://github.com/hashicorp/terraform-ls/pull/1634), [#1658](https://github.com/hashicorp/terraform-ls/pull/1658)) -* build(deps): Bump go.opentelemetry.io/otel from 1.23.1 to 1.24.0 ([#1644](https://github.com/hashicorp/terraform-ls/pull/1644)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.48.0 to 0.49.0 ([#1647](https://github.com/hashicorp/terraform-ls/pull/1647)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.48.0 to 0.49.0 ([#1646](https://github.com/hashicorp/terraform-ls/pull/1646)) -* build(deps): Bump github.com/zclconf/go-cty from 1.14.2 to 1.14.3 ([#1654](https://github.com/hashicorp/terraform-ls/pull/1654)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.31.0 to 3.31.1 ([#1657](https://github.com/hashicorp/terraform-ls/pull/1657)) -* build(deps): Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 ([#1653](https://github.com/hashicorp/terraform-ls/pull/1653)) - -## 0.33.0-beta1 (29 February 2024) - -BUG FIXES: - -* Fix panics on `nil` expressions ([hcl-lang#376](https://github.com/hashicorp/hcl-lang/pull/376)) -* Fix panics on `nil` expressions in early decoder ([terraform-schema#324](https://github.com/hashicorp/terraform-schema/pull/324)) - -## 0.32.7 (13 February 2024) - -ENHANCEMENTS: - -* Support `for`-`in`-`if` expressions ([hcl-lang#368](https://github.com/hashicorp/hcl-lang/pull/368)) - -BUG FIXES: - -* Fix prefix completion in `TemplateWrapExpr` ([hcl-lang#371](https://github.com/hashicorp/hcl-lang/pull/371)) -* Fix LS panic on prefix completion with leading space ([hcl-lang#373](https://github.com/hashicorp/hcl-lang/pull/373)) -* Fix LS panic on missing symbols in client capabilities ([#1619](https://github.com/hashicorp/terraform-ls/pull/1619)) - -INTERNAL: - -* github: Remove benchmarks workflow ([#1599](https://github.com/hashicorp/terraform-ls/pull/1599)) -* chore: fix typo in comment ([#1612](https://github.com/hashicorp/terraform-ls/pull/1612)) -* build(deps): Bump github.com/zclconf/go-cty from 1.14.1 to 1.14.2 ([#1600](https://github.com/hashicorp/terraform-ls/pull/1600)) -* build(deps): Bump go.opentelemetry.io/otel from 1.22.0 to 1.23.1 ([#1617](https://github.com/hashicorp/terraform-ls/pull/1617), [#1621](https://github.com/hashicorp/terraform-ls/pull/1621)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.47.0 to 0.48.0 ([#1616](https://github.com/hashicorp/terraform-ls/pull/1616)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.47.0 to 0.48.0 ([#1618](https://github.com/hashicorp/terraform-ls/pull/1618)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.6.2 to 0.6.3 ([#1622](https://github.com/hashicorp/terraform-ls/pull/1622)) -* build(deps): Bump workflows to latest trusted versions ([#1624](https://github.com/hashicorp/terraform-ls/pull/1624)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.40.1 to 2.40.3 ([#1625](https://github.com/hashicorp/terraform-ls/pull/1625)) - -## 0.32.6 (23 January 2024) - -ENHANCEMENTS: - -* Enable interpolated map keys and object attribute names ([terraform-schema#316](https://github.com/hashicorp/terraform-schema/pull/316)) -* Add support for complex index expressions ([hcl-lang#365](https://github.com/hashicorp/hcl-lang/pull/365)) -* Add support for parenthesis on RHS ([hcl-lang#366](https://github.com/hashicorp/hcl-lang/pull/366)) -* Add support for parenthesis on LHS (map keys & attribute names) ([hcl-lang#367](https://github.com/hashicorp/hcl-lang/pull/367)) - -BUG FIXES: - -* Revert "Alert on `wsl.localhost` Path ([#1522](https://github.com/hashicorp/terraform-ls/pull/1522))" ([#1597](https://github.com/hashicorp/terraform-ls/pull/1597)) - -INTERNAL: - -* build(deps): Bump go.opentelemetry.io/otel from 1.21.0 to 1.22.0 ([#1589](https://github.com/hashicorp/terraform-ls/pull/1589)) -* build(deps): Bump go.opentelemetry.io/otel/trace from 1.21.0 to 1.22.0 ([#1588](https://github.com/hashicorp/terraform-ls/pull/1588)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.20.0 to 0.21.0 ([#1591](https://github.com/hashicorp/terraform-ls/pull/1591)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.46.1 to 0.47.0 ([#1592](https://github.com/hashicorp/terraform-ls/pull/1592)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.46.1 to 0.47.0 ([#1593](https://github.com/hashicorp/terraform-ls/pull/1593)) -* build(deps): Bump workflows to latest trusted versions ([#1594](https://github.com/hashicorp/terraform-ls/pull/1594)) - -## 0.32.5 (16 January 2024) - -ENHANCEMENTS: - -* Alert on `wsl.localhost` Path ([#1522](https://github.com/hashicorp/terraform-ls/pull/1522)) -* Enable `for_each` for `import` blocks (Terraform 1.7) ([terraform-schema#315](https://github.com/hashicorp/terraform-schema/pull/315)) -* Add `removed` block (Terraform 1.7) ([terraform-schema#313](https://github.com/hashicorp/terraform-schema/pull/313)) -* Deprecate `use_legacy_workflow` in S3 Backend (Terraform 1.7) ([terraform-schema#314](https://github.com/hashicorp/terraform-schema/pull/314)) - -INTERNAL: - -* docs: update syntax-highlighting.md ([#1528](https://github.com/hashicorp/terraform-ls/pull/1528)) -* go: bump version to 1.21.5 ([#1521](https://github.com/hashicorp/terraform-ls/pull/1521)) -* ci: Automate releasing via bob ([#1167](https://github.com/hashicorp/terraform-ls/pull/1167)) -* build(deps): Bump golang.org/x/tools from 0.16.0 to 0.17.0 ([#1519](https://github.com/hashicorp/terraform-ls/pull/1519), [#1578](https://github.com/hashicorp/terraform-ls/pull/1578)) -* build(deps): Bump golang.org/x/crypto from 0.16.0 to 0.17.0 ([#1524](https://github.com/hashicorp/terraform-ls/pull/1524)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.18.0 to 0.20.0 ([#1541](https://github.com/hashicorp/terraform-ls/pull/1541), [#1547](https://github.com/hashicorp/terraform-ls/pull/1547)) -* build(deps): Bump github.com/hashicorp/terraform-exec from 0.19.0 to 0.20.0 ([#1543](https://github.com/hashicorp/terraform-ls/pull/1543)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.38.0 to 2.40.1 ([#1542](https://github.com/hashicorp/terraform-ls/pull/1542), [#1544](https://github.com/hashicorp/terraform-ls/pull/1544), [#1576](https://github.com/hashicorp/terraform-ls/pull/1576), [#1581](https://github.com/hashicorp/terraform-ls/pull/1581)) -* build(deps): Bump workflows to latest trusted versions ([#1520](https://github.com/hashicorp/terraform-ls/pull/1520), [#1571](https://github.com/hashicorp/terraform-ls/pull/1571), [#1579](https://github.com/hashicorp/terraform-ls/pull/1579)) -* Rename `hcl-typeCapsule` to `hcl-typeComplex` ([#1529](https://github.com/hashicorp/terraform-ls/pull/1529)) -* Rename `hcl-traversalStep` to `hcl-referenceStep` ([#1574](https://github.com/hashicorp/terraform-ls/pull/1574)) - -## 0.32.4 (12 December 2023) - -ENHANCEMENTS: - -* Add support for conditional expression ([hcl-lang#326](https://github.com/hashicorp/hcl-lang/pull/326)) -* Add support for template expressions ([hcl-lang#322](https://github.com/hashicorp/hcl-lang/pull/322)) -* Reflect new SSO endpoint override in S3 backend ([terraform-schema#302](https://github.com/hashicorp/terraform-schema/pull/302)) -* Reflect new proxy settings in S3 backend ([terraform-schema#301](https://github.com/hashicorp/terraform-schema/pull/301)) -* Reflect new `skip_s3_checksum` attribute in S3 backend ([terraform-schema#295](https://github.com/hashicorp/terraform-schema/pull/295)) - -BUG FIXES: - -* Improve traversal completion for lists, tuples, and sets ([hcl-lang#344](https://github.com/hashicorp/hcl-lang/pull/344)) -* Update version resolution for empty constraints ([terraform-schema#296](https://github.com/hashicorp/terraform-schema/pull/296)) - -INTERNAL: - -* Add new performance issue template ([#1499](https://github.com/hashicorp/terraform-ls/pull/1499)) -* go: Bump version to 1.21.4 ([#1511](https://github.com/hashicorp/terraform-ls/pull/1511)) -* github: Disable dependabot for GHA ([#1489](https://github.com/hashicorp/terraform-ls/pull/1489)) -* build(deps): Bump golang.org/x/tools from 0.14.0 to 0.15.0 ([#1491](https://github.com/hashicorp/terraform-ls/pull/1491), [#1513](https://github.com/hashicorp/terraform-ls/pull/1513)) -* build(deps): Bump workflows to latest trusted versions ([#1493](https://github.com/hashicorp/terraform-ls/pull/1493), [#1510](https://github.com/hashicorp/terraform-ls/pull/1510), [#1514](https://github.com/hashicorp/terraform-ls/pull/1514)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.36.1 to 2.38.0 ([#1498](https://github.com/hashicorp/terraform-ls/pull/1498), [#1500](https://github.com/hashicorp/terraform-ls/pull/1500), [#1509](https://github.com/hashicorp/terraform-ls/pull/1509)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.17.1 to 0.18.0 ([#1492](https://github.com/hashicorp/terraform-ls/pull/1492)) -* build(deps): Bump go.opentelemetry.io/otel from 1.19.0 to 1.20.0 ([#1494](https://github.com/hashicorp/terraform-ls/pull/1494)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.45.0 to 0.46.0 ([#1496](https://github.com/hashicorp/terraform-ls/pull/1496)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.45.0 to 0.46.0 ([#1497](https://github.com/hashicorp/terraform-ls/pull/1497)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.46.0 to 0.46.1 ([#1501](https://github.com/hashicorp/terraform-ls/pull/1501)) -* build(deps): Bump github.com/creachadair/jrpc2 from 1.1.1 to 1.1.2 ([#1504](https://github.com/hashicorp/terraform-ls/pull/1504)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.6.1 to 0.6.2 ([#1516](https://github.com/hashicorp/terraform-ls/pull/1516)) - -## 0.32.3 (7 November 2023) - -BUG FIXES: - -* Validate required attributes more selectively to relax `provider` validation ([#1485](https://github.com/hashicorp/terraform-ls/pull/1485)) -* Skip inferring variable type from default values ([hcl-lang#338](https://github.com/hashicorp/hcl-lang/pull/338)) -* Ensure partially unknown dependent body is handled ([hcl-lang#339](https://github.com/hashicorp/hcl-lang/pull/339)) -* Fix type-unaware target collection ([hcl-lang#340](https://github.com/hashicorp/hcl-lang/pull/340)) -* Allow variable references in `depends_on` ([terraform-schema#290](https://github.com/hashicorp/terraform-schema/pull/290)) -* Fix provider attribute to block conversion ([terraform-schema#288](https://github.com/hashicorp/terraform-schema/pull/288)) -* Skip inferring module inputs for default values ([terraform-schema#289](https://github.com/hashicorp/terraform-schema/pull/289)) -* Allow local references in `depends_on` ([terraform-schema#292](https://github.com/hashicorp/terraform-schema/pull/292)) - -INTERNAL: - -* go: bump version to 1.21.3 ([#1467](https://github.com/hashicorp/terraform-ls/pull/1467)) -* validations: Add link in comment to open issue ([#1472](https://github.com/hashicorp/terraform-ls/pull/1472)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.35.3 to 2.36.1 ([#1463](https://github.com/hashicorp/terraform-ls/pull/1463), [#1465](https://github.com/hashicorp/terraform-ls/pull/1465), [#1487](https://github.com/hashicorp/terraform-ls/pull/1487)) -* build(deps): Bump github.com/hashicorp/hcl/v2 from 2.18.1 to 2.19.1 ([#1466](https://github.com/hashicorp/terraform-ls/pull/1466), [#1468](https://github.com/hashicorp/terraform-ls/pull/1468)) -* build(deps): Bump actions/checkout from 4.1.0 to 4.1.1 ([#1469](https://github.com/hashicorp/terraform-ls/pull/1469)) -* build(deps): Bump github.com/hashicorp/terraform-registry-address from 0.2.2 to 0.2.3 ([#1482](https://github.com/hashicorp/terraform-ls/pull/1482)) - -## 0.32.2 (12 October 2023) - -ENHANCEMENTS: - -* Add `skip_requesting_account_id` to `s3` backend ([terraform-schema#279](https://github.com/hashicorp/terraform-schema/pull/279)) - -BUG FIXES: - -* Work around 'unreliable' input data for Registry modules ([#1456](https://github.com/hashicorp/terraform-ls/pull/1456)) -* Resolve version correctly for backend schema ([#1453](https://github.com/hashicorp/terraform-ls/pull/1453)) -* Allow objects in `for_each` ([hcl-lang#333](https://github.com/hashicorp/hcl-lang/pull/333)) -* Fix `output` block `precondition` in 1.2 schema ([terraform-schema#282](https://github.com/hashicorp/terraform-schema/pull/282)) - -INTERNAL: - -* build(deps): Bump github.com/vektra/mockery/v2 from 2.35.1 to 2.35.3 ([#1451](https://github.com/hashicorp/terraform-ls/pull/1451), [#1452](https://github.com/hashicorp/terraform-ls/pull/1452)) -* build(deps): Bump golang.org/x/tools from 0.13.0 to 0.14.0 ([#1450](https://github.com/hashicorp/terraform-ls/pull/1450)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.6.0 to 0.6.1 ([#1454](https://github.com/hashicorp/terraform-ls/pull/1454)) -* build(deps): Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 ([#1457](https://github.com/hashicorp/terraform-ls/pull/1457)) -* build(deps): Bump golang.org/x/net from 0.16.0 to 0.17.0 ([#1460](https://github.com/hashicorp/terraform-ls/pull/1460)) - -## 0.32.1 (6 October 2023) - -ENHANCEMENTS: - -* decoder: Add support for binary & unary operators ([hcl-lang#320](https://github.com/hashicorp/hcl-lang/pull/320)) - -BUG FIXES: - -* Fix incorrect schema for `terraform_remote_state` data source ([terraform-schema#272](https://github.com/hashicorp/terraform-schema/pull/272)) -* Make `cloud` `organization` optional ([terraform-schema#271](https://github.com/hashicorp/terraform-schema/pull/271)) -* Ensure empty objects & tuples still get recognised ([hcl-lang#330](https://github.com/hashicorp/hcl-lang/pull/330)) -* Introduce default value `"ssh"` for `type` under `connection` block to enable recognition of attributes such as `bastion_host` even when `type` is not declared ([hcl-lang#327](https://github.com/hashicorp/hcl-lang/pull/327), [terraform-schema#270](https://github.com/hashicorp/terraform-schema/pull/270)) -* Introduce v1.3 proxy related fields for provisioner `connection` block ([terraform-schema#269](https://github.com/hashicorp/terraform-schema/pull/269)) -* Ensure `target_platform` is recognised in nested `connection` block ([terraform-schema#268](https://github.com/hashicorp/terraform-schema/pull/268)) - -## 0.32.0 (4 October 2023) - -ENHANCEMENTS: - -* Enhanced validation provides additional diagnostics for [selected invalid Terraform language constructs](https://github.com/hashicorp/terraform-ls/blob/v0.32.0/docs/validation.md#enhanced-validation) based on detected Terraform version and provider versions are provided. ([#1368](https://github.com/hashicorp/terraform-ls/pull/1368)) -* Improve performance by parsing changed `*.tf` file (as opposed to all files in the module) ([#1404](https://github.com/hashicorp/terraform-ls/pull/1404)) -* Improve performance by parsing changed `*.tfvars` file (as opposed to all files in the directory) ([#1422](https://github.com/hashicorp/terraform-ls/pull/1422)) -* Add `project` attribute to workspaces block ([terraform-schema#257](https://github.com/hashicorp/terraform-schema/pull/257)) -* Update `import` ID to be interpolatable ([terraform-schema#260](https://github.com/hashicorp/terraform-schema/pull/260)) -* Add `nullable` to `variable` blocks for `v1.1+` ([terraform-schema#261](https://github.com/hashicorp/terraform-schema/pull/261)) -* Add `endpoint` and `domain` to `cos` backend ([terraform-schema#262](https://github.com/hashicorp/terraform-schema/pull/262)) -* Add `proxy_url` to `kubernetes` backend ([terraform-schema#263](https://github.com/hashicorp/terraform-schema/pull/263)) -* Update `s3` backend with `v1.6` changes ([terraform-schema#265](https://github.com/hashicorp/terraform-schema/pull/265)) - -BUG FIXES: - -* Allow `list(any)` to be passed into `dynamic` block's `for_each` ([hcl-lang#313](https://github.com/hashicorp/hcl-lang/pull/313)) -* Make `dynamic` `content` block required ([hcl-lang#314](https://github.com/hashicorp/hcl-lang/pull/314)) -* indexer: Ensure declared module calls get decoded ([#1395](https://github.com/hashicorp/terraform-ls/pull/1395)) - -INTERNAL: - -* go: bump version to `1.21.1` ([#1408](https://github.com/hashicorp/terraform-ls/pull/1408)) -* build(deps): Bump actions/checkout from 3.6.0 to 4.1.0 ([#1382](https://github.com/hashicorp/terraform-ls/pull/1382), [#1420](https://github.com/hashicorp/terraform-ls/pull/1420)) -* build(deps): Bump actions/upload-artifact from 3.1.2 to 3.1.3 ([#1393](https://github.com/hashicorp/terraform-ls/pull/1393)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.30.1 to 3.31.0 ([#1387](https://github.com/hashicorp/terraform-ls/pull/1387)) -* build(deps): Bump github.com/otiai10/copy from 1.12.0 to 1.14.0 ([#1432](https://github.com/hashicorp/terraform-ls/pull/1432)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.33.0 to 2.34.2 ([#1388](https://github.com/hashicorp/terraform-ls/pull/1388), [#1411](https://github.com/hashicorp/terraform-ls/pull/1411), [#1419](https://github.com/hashicorp/terraform-ls/pull/1419), [#1421](https://github.com/hashicorp/terraform-ls/pull/1421), [#1423](https://github.com/hashicorp/terraform-ls/pull/1423)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.42.0 to 0.45.0 ([#1390](https://github.com/hashicorp/terraform-ls/pull/1390), [#1405](https://github.com/hashicorp/terraform-ls/pull/1405), [#1430](https://github.com/hashicorp/terraform-ls/pull/1430)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.42.0 to 0.43.0 ([#1385](https://github.com/hashicorp/terraform-ls/pull/1385)) -* build(deps): Bump go.opentelemetry.io/otel from 1.17.0 to 1.19.0 ([#1401](https://github.com/hashicorp/terraform-ls/pull/1401), [#1428](https://github.com/hashicorp/terraform-ls/pull/1428)) -* build(deps): Bump go.opentelemetry.io/otel/trace from 1.16.0 to 1.17.0 ([#1389](https://github.com/hashicorp/terraform-ls/pull/1389)) -* build(deps): Bump golang.org/x/tools from 0.12.0 to 0.13.0 ([#1386](https://github.com/hashicorp/terraform-ls/pull/1386)) - -## 0.31.5 (4 September 2023) - -ENHANCEMENTS: - -* jobs: Improve `PreloadEmbeddedSchema` performance ([#1369](https://github.com/hashicorp/terraform-ls/pull/1369)) -* langserver: Avoid re-processing open files after file saving to improve performance ([#1372](https://github.com/hashicorp/terraform-ls/pull/1372)) - -INTERNAL: - -* go: Bump version to 1.21 ([#1355](https://github.com/hashicorp/terraform-ls/pull/1355)) -* Bump terraform-schema and hcl-lang ([#1350](https://github.com/hashicorp/terraform-ls/pull/1350), [#1374](https://github.com/hashicorp/terraform-ls/pull/1374)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.32.0 to 2.33.0 ([#1345](https://github.com/hashicorp/terraform-ls/pull/1345), [#1348](https://github.com/hashicorp/terraform-ls/pull/1348), [#1356](https://github.com/hashicorp/terraform-ls/pull/1356), [#1360](https://github.com/hashicorp/terraform-ls/pull/1360)) -* build(deps): Bump golang.org/x/tools from 0.11.1 to 0.12.0 ([#1351](https://github.com/hashicorp/terraform-ls/pull/1351)) -* build(deps): Bump actions/setup-go from 4.0.1 to 4.1.0 ([#1354](https://github.com/hashicorp/terraform-ls/pull/1354)) -* build(deps): Bump github.com/creachadair/jrpc2 from 1.1.0 to 1.1.1 ([#1359](https://github.com/hashicorp/terraform-ls/pull/1359)) -* build(deps): Bump actions/checkout from 3.5.3 to 3.6.0 ([#1362](https://github.com/hashicorp/terraform-ls/pull/1362)) - -## 0.31.4 (1 August 2023) - -ENHANCEMENTS: - -* OTEL instrumentation (currently no-op for end-users) ([#1327](https://github.com/hashicorp/terraform-ls/pull/1327), [#1334](https://github.com/hashicorp/terraform-ls/pull/1334)) -* jobs: Don't wait for `GetModuleDataFromRegistry` job to improve performance ([#1332](https://github.com/hashicorp/terraform-ls/pull/1332)) - -INTERNAL: - -* build(deps): Bump golang.org/x/tools from 0.11.0 to 0.11.1 ([#1342](https://github.com/hashicorp/terraform-ls/pull/1342)) -* deps: Bump terraform-schema to `8234469` ([#1343](https://github.com/hashicorp/terraform-ls/pull/1343)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.30.1 to 2.30.16 ([#1319](https://github.com/hashicorp/terraform-ls/pull/1319)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.17.0 to 0.17.1 ([#1320](https://github.com/hashicorp/terraform-ls/pull/1320)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.30.0 to 3.30.1 ([#1322](https://github.com/hashicorp/terraform-ls/pull/1322)) -* build(deps): Bump golang.org/x/tools from 0.10.0 to 0.11.0 ([#1323](https://github.com/hashicorp/terraform-ls/pull/1323)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.30.16 to 2.30.17 ([#1325](https://github.com/hashicorp/terraform-ls/pull/1325)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.30.17 to 2.31.1 ([#1326](https://github.com/hashicorp/terraform-ls/pull/1326)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.31.1 to 2.31.4 ([#1328](https://github.com/hashicorp/terraform-ls/pull/1328)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.31.4 to 2.32.0 ([#1329](https://github.com/hashicorp/terraform-ls/pull/1329)) -* build(deps): Bump github.com/creachadair/jrpc2 from 1.0.1 to 1.1.0 ([#1330](https://github.com/hashicorp/terraform-ls/pull/1330)) -* Change `nvim_create_autocmd` callback to a lambda ([#1295](https://github.com/hashicorp/terraform-ls/pull/1295)) -* Fix link in README.md ([#1324](https://github.com/hashicorp/terraform-ls/pull/1324)) - -## 0.31.3 (20 June 2023) - -ENHANCEMENTS: - -* Introduce v1.5 `check` block ([#229](https://github.com/hashicorp/terraform-schema/pull/229)) -* Introduce v1.5 `import` block ([#228](https://github.com/hashicorp/terraform-schema/pull/228)) -* Re-generate function signatures for v1.5 ([#213](https://github.com/hashicorp/terraform-schema/pull/213)) -* Add v1.4 `local-exec` provisioner `quiet` attribute ([#218](https://github.com/hashicorp/terraform-schema/pull/218)) -* Reflect 1.4 changes in `gcs` backend ([#227](https://github.com/hashicorp/terraform-schema/pull/227)) -* Reflect 1.4 changes in `http` backend ([#226](https://github.com/hashicorp/terraform-schema/pull/226)) -* Reflect 1.3 & 1.4 changes in `cos` backend ([#217](https://github.com/hashicorp/terraform-schema/pull/217)) -* Reflect 1.2 & 1.3 changes in `azurerm` backend ([#225](https://github.com/hashicorp/terraform-schema/pull/225)) - -INTERNAL: -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.29.1 to 3.29.2 ([#1281](https://github.com/hashicorp/terraform-ls/pull/1281)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.29.2 to 3.29.4 ([#1289](https://github.com/hashicorp/terraform-ls/pull/1289)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.29.4 to 3.30.0 ([#1305](https://github.com/hashicorp/terraform-ls/pull/1305)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.5.1 to 0.5.2 ([#1282](https://github.com/hashicorp/terraform-ls/pull/1282)) -* build(deps): Bump github.com/hashicorp/hcl/v2 from 2.16.2 to 2.17.0 ([#1298](https://github.com/hashicorp/terraform-ls/pull/1298)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.16.0 to 0.17.0 ([#1308](https://github.com/hashicorp/terraform-ls/pull/1308)) -* build(deps): Bump github.com/hashicorp/terraform-registry-address from 0.2.0 to 0.2.1 ([#1311](https://github.com/hashicorp/terraform-ls/pull/1311)) -* build(deps): Bump github.com/otiai10/copy from 1.11.0 to 1.12.0 ([#1313](https://github.com/hashicorp/terraform-ls/pull/1313)) -* build(deps): Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 ([#1288](https://github.com/hashicorp/terraform-ls/pull/1288)) -* build(deps): Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 ([#1294](https://github.com/hashicorp/terraform-ls/pull/1294)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.26.1 to 2.27.1 ([#1285](https://github.com/hashicorp/terraform-ls/pull/1285)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.27.1 to 2.28.1 ([#1293](https://github.com/hashicorp/terraform-ls/pull/1293)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.28.1 to 2.28.2 ([#1302](https://github.com/hashicorp/terraform-ls/pull/1302)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.28.2 to 2.29.0 ([#1306](https://github.com/hashicorp/terraform-ls/pull/1306)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.29.0 to 2.30.1 ([#1310](https://github.com/hashicorp/terraform-ls/pull/1310)) -* build(deps): Bump github.com/zclconf/go-cty from 1.13.1 to 1.13.2 ([#1290](https://github.com/hashicorp/terraform-ls/pull/1290)) -* build(deps): Bump golang.org/x/tools from 0.9.1 to 0.9.2 ([#1299](https://github.com/hashicorp/terraform-ls/pull/1299)) -* build(deps): Bump golang.org/x/tools from 0.9.2 to 0.9.3 ([#1301](https://github.com/hashicorp/terraform-ls/pull/1301)) -* build(deps): Bump golang.org/x/tools from 0.9.3 to 0.10.0 ([#1312](https://github.com/hashicorp/terraform-ls/pull/1312)) - -## 0.31.2 (11 May 2023) - -BUG FIXES: - -* Fix crash on prefix completion ([hcl-lang#275](https://github.com/hashicorp/hcl-lang/pull/275)) - -INTERNAL: - -* Remove automated milestone closure commenting ([#1266](https://github.com/hashicorp/terraform-ls/pull/1266)) - -## 0.31.1 (27 April 2023) - -ENHANCEMENTS: - -* Cache registry module errors to improve performance in cases of private registry, submodules or other similar situations resulting in module data unavailability ([#1258](https://github.com/hashicorp/terraform-ls/pull/1258)) - -BUG FIXES: - -* Pull in gopls v0.10.0 tsprotocol.go to fix completion labels ([#1256](https://github.com/hashicorp/terraform-ls/pull/1256)) - -INTERNAL: - -* Add PR test for copyright headers ([#1241](https://github.com/hashicorp/terraform-ls/pull/1241)) - -## 0.31.0 (18 April 2023) - -ENHANCEMENTS: - -* Add support for nested expressions and functions ([#1237](https://github.com/hashicorp/terraform-ls/pull/1237), [hcl-lang#232](https://github.com/hashicorp/hcl-lang/pull/232), [hcl-lang#203](https://github.com/hashicorp/hcl-lang/pull/203), [hcl-lang#199](https://github.com/hashicorp/hcl-lang/pull/199), [hcl-lang#186](https://github.com/hashicorp/hcl-lang/pull/186), [hcl-lang#185](https://github.com/hashicorp/hcl-lang/pull/185), [hcl-lang#184](https://github.com/hashicorp/hcl-lang/pull/184)) -* Add support for function signature help in ([#1077](https://github.com/hashicorp/terraform-ls/pull/1077)) -* Fix remote backend tracking in ([#1218](https://github.com/hashicorp/terraform-ls/pull/1218)) -* lsp: Recognise new token type for function names in ([#1233](https://github.com/hashicorp/terraform-ls/pull/1233)) - -INTERNAL: - -* Add instructions for Kate editor ([#1200](https://github.com/hashicorp/terraform-ls/pull/1200)) -* Add TFC usage detection ([#1208](https://github.com/hashicorp/terraform-ls/pull/1208)) - -BUG FIXES: - -* Reflect `LiteralValue`, `Description` & `IsDeprecated` in completion/hover ([hcl-lang#253](https://github.com/hashicorp/hcl-lang/pull/253)) -* Fix crash when completing `LiteralType{Type: cty.Tuple}` ([hcl-lang#255](https://github.com/hashicorp/hcl-lang/pull/255)) -* Display `Tuple` hover data on invalid element ([hcl-lang#254](https://github.com/hashicorp/hcl-lang/pull/254)) -* Fix collection of implied declared targets of complex types ([hcl-lang#259](https://github.com/hashicorp/hcl-lang/pull/259)) -* Collect targets w/ interpolation for `Any` correctly ([hcl-lang#257](https://github.com/hashicorp/hcl-lang/pull/257)) - -## 0.31.0-beta (6 April 2023) - -ENHANCEMENTS: - -* Add support for nested expressions and functions ([#1237](https://github.com/hashicorp/terraform-ls/pull/1237), [hcl-lang#232](https://github.com/hashicorp/hcl-lang/pull/232), [hcl-lang#203](https://github.com/hashicorp/hcl-lang/pull/203), [hcl-lang#199](https://github.com/hashicorp/hcl-lang/pull/199), [hcl-lang#186](https://github.com/hashicorp/hcl-lang/pull/186), [hcl-lang#185](https://github.com/hashicorp/hcl-lang/pull/185), [hcl-lang#184](https://github.com/hashicorp/hcl-lang/pull/184), ) -* Add support for function signature help in ([#1077](https://github.com/hashicorp/terraform-ls/pull/1077)) -* Fix remote backend tracking in ([#1218](https://github.com/hashicorp/terraform-ls/pull/1218)) -* lsp: Recognise new token type for function names in ([#1233](https://github.com/hashicorp/terraform-ls/pull/1233)) - -INTERNAL: - -* Add instructions for Kate editor ([#1200](https://github.com/hashicorp/terraform-ls/pull/1200)) -* Add TFC usage detection ([#1208](https://github.com/hashicorp/terraform-ls/pull/1208)) -* build(deps): bump actions/checkout from 3.3.0 to 3.4.0 ([#1215](https://github.com/hashicorp/terraform-ls/pull/1215)) -* build(deps): bump actions/checkout from 3.4.0 to 3.5.0 ([#1228](https://github.com/hashicorp/terraform-ls/pull/1228)) -* build(deps): bump actions/setup-go from 3.5.0 to 4.0.0 ([#1214](https://github.com/hashicorp/terraform-ls/pull/1214)) -* build(deps): bump actions/stale from 7.0.0 to 8.0.0 ([#1222](https://github.com/hashicorp/terraform-ls/pull/1222)) -* build(deps): bump github.com/algolia/algoliasearch-client-go/v3 from 3.26.3 to 3.26.4 ([#1198](https://github.com/hashicorp/terraform-ls/pull/1198)) -* build(deps): bump github.com/algolia/algoliasearch-client-go/v3 from 3.26.4 to 3.26.5 ([#1230](https://github.com/hashicorp/terraform-ls/pull/1230)) -* build(deps): bump github.com/algolia/algoliasearch-client-go/v3 from 3.26.5 to 3.27.0 ([#1231](https://github.com/hashicorp/terraform-ls/pull/1231)) -* build(deps): bump github.com/creachadair/jrpc2 from 0.44.0 to 0.45.0 ([#1213](https://github.com/hashicorp/terraform-ls/pull/1213)) -* build(deps): bump github.com/creachadair/jrpc2 from 0.46.0 to 1.0.0 ([#1227](https://github.com/hashicorp/terraform-ls/pull/1227)) -* build(deps): bump github.com/creachadair/jrpc2 to v0.46.0 ([#1217](https://github.com/hashicorp/terraform-ls/pull/1217)) -* build(deps): bump github.com/hashicorp/hc-install from 0.5.0 to 0.5.1 ([#1232](https://github.com/hashicorp/terraform-ls/pull/1232)) -* build(deps): bump github.com/hashicorp/hcl/v2 from 2.16.1 to 2.16.2 ([#1205](https://github.com/hashicorp/terraform-ls/pull/1205)) -* build(deps): bump github.com/hashicorp/terraform-exec from 0.18.0 to 0.18.1 ([#1201](https://github.com/hashicorp/terraform-ls/pull/1201)) -* build(deps): bump github.com/hashicorp/terraform-json from 0.15.0 to 0.16.0 ([#1206](https://github.com/hashicorp/terraform-ls/pull/1206)) -* build(deps): bump github.com/hashicorp/terraform-registry-address from 0.0.0-20220623143253-7d51757b572c to 0.1.0 ([#1196](https://github.com/hashicorp/terraform-ls/pull/1196)) -* build(deps): bump github.com/hashicorp/terraform-registry-address from 0.1.0 to 0.2.0 ([#1226](https://github.com/hashicorp/terraform-ls/pull/1226)) -* build(deps): bump github.com/otiai10/copy from 1.9.0 to 1.10.0 ([#1236](https://github.com/hashicorp/terraform-ls/pull/1236)) -* build(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 ([#1199](https://github.com/hashicorp/terraform-ls/pull/1199)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.20.2 to 2.21.1 ([#1202](https://github.com/hashicorp/terraform-ls/pull/1202)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.21.1 to 2.21.4 ([#1204](https://github.com/hashicorp/terraform-ls/pull/1204)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.21.4 to 2.21.6 ([#1207](https://github.com/hashicorp/terraform-ls/pull/1207)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.21.6 to 2.22.1 ([#1209](https://github.com/hashicorp/terraform-ls/pull/1209)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.22.1 to 2.23.0 ([#1219](https://github.com/hashicorp/terraform-ls/pull/1219)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.23.0 to 2.23.1 ([#1221](https://github.com/hashicorp/terraform-ls/pull/1221)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.23.1 to 2.23.2 ([#1235](https://github.com/hashicorp/terraform-ls/pull/1235)) -* build(deps): bump github.com/zclconf/go-cty from 1.12.1 to 1.13.0 ([#1197](https://github.com/hashicorp/terraform-ls/pull/1197)) -* build(deps): bump github.com/zclconf/go-cty from 1.13.0 to 1.13.1 ([#1216](https://github.com/hashicorp/terraform-ls/pull/1216)) -* build(deps): bump golang.org/x/tools from 0.6.0 to 0.7.0 ([#1203](https://github.com/hashicorp/terraform-ls/pull/1203)) -* build(deps): Bump hcl-lang & terraform-schema to latest revisions ([#1237](https://github.com/hashicorp/terraform-ls/pull/1237)) - -## 0.30.3 (22 February 2023) - -BUG FIXES: - - - Enable static builds of Linux binaries (again) ([#1193](https://github.com/hashicorp/terraform-ls/pull/1193)) - -## 0.30.2 (15 February 2023) - -NOTES / BREAKING CHANGES: - - - We have changed our release process: all assets continue to be available from the [HashiCorp Releases site](https://releases.hashicorp.com/terraform-ls) and/or via the [Releases API](https://releases.hashicorp.com/docs/api/v1/), not as GitHub Release assets anymore. - -ENHANCEMENTS: - - - Parse `optional()` object attribute _default values_ correctly, as introduced in Terraform v1.3 ([terraform-schema#184](https://github.com/hashicorp/terraform-schema/pull/184)) - -BUG FIXES: - - - Ignore inaccessible files (such as emacs backup files) ([terraform-ls#1172](https://github.com/hashicorp/terraform-ls/issues/1067])) - - Fix crash when parsing JSON files (introduced in 0.30.0) ([hcl-lang#202](https://github.com/hashicorp/hcl-lang/pull/202])) - -INTERNAL: - - - Remove `schema.TupleConsExpr` ([hcl-lang#175](https://github.com/hashicorp/hcl-lang/pull/175)) - - internal/schema: Replace `TupleConsExpr` with `SetExpr` ([terraform-schema#169](https://github.com/hashicorp/terraform-schema/pull/169)) - - Use upstreamed HCL typexpr package ([terraform-schema#168](https://github.com/hashicorp/terraform-schema/pull/168)) - -## 0.30.1 (1 December 2022) - -BUG FIXES: - - - Support `dynamic` in the `provisioner` and `provider` blocks ([terraform-schema#165](https://github.com/hashicorp/terraform-schema/pull/165)) - - Fix `dynamic` block `for_each` description ([hcl-lang#164](https://github.com/hashicorp/hcl-lang/pull/164)) - - Avoid completing static block inside a `dynamic` label ([hcl-lang#165](https://github.com/hashicorp/hcl-lang/pull/165)) - - Fix missing hover for `count` and `for_each` expression ([hcl-lang#166](https://github.com/hashicorp/hcl-lang/pull/166)) - - Fix support of deeper nesting of `dynamic` block ([hcl-lang#167](https://github.com/hashicorp/hcl-lang/pull/167)) - - Change `dynamic` block type to default ([hcl-lang#168](https://github.com/hashicorp/hcl-lang/pull/168)) - -## 0.30.0 (24 November 2022) - -ENHANCEMENTS: - - - Support `count.index` references in blocks with `count` for completion, hover documentation and semantic tokens highlighting ([#860](https://github.com/hashicorp/terraform-ls/issues/860), [hcl-lang#160](https://github.com/hashicorp/hcl-lang/pull/160)) - - Support `each.*` references in blocks with `for_each` for completion, hover documentation and semantic tokens highlighting ([#861](https://github.com/hashicorp/terraform-ls/issues/861), [hcl-lang#162](https://github.com/hashicorp/hcl-lang/pull/162)) - - Support `self.*` references in `provisioner`, `connection` and `postcondition` blocks for completion, hover documentation and semantic tokens highlighting ([#859](https://github.com/hashicorp/terraform-ls/issues/859), [hcl-lang#163](https://github.com/hashicorp/hcl-lang/pull/163)) - - `dynamic` block support, including label and content completion ([#530](https://github.com/hashicorp/terraform-ls/issues/530), [hcl-lang#154](https://github.com/hashicorp/hcl-lang/pull/154)) - - Go-to-definition/go-to-references for `count.index`/`count` ([#1093](https://github.com/hashicorp/terraform-ls/issues/1093)) - - Go-to-definition/go-to-references for `each.*`/`for_each` ([#1095](https://github.com/hashicorp/terraform-ls/issues/1095)) - - Go-to-definition/go-to-references for `self.*` in `provisioner`, `connection` and `postcondition` blocks ([#1096](https://github.com/hashicorp/terraform-ls/issues/1096)) - - Remove deprecated backends in Terraform 1.3.0 ([terraform-schema#159](https://github.com/hashicorp/terraform-schema/pull/159)) - -## 0.29.3 (13 October 2022) - -ENHANCEMENTS: - - - schemas: Lazy-load embedded provider schemas ([#1071](https://github.com/hashicorp/terraform-ls/pull/1071)) - - Reduced runtime memory consumption from static ~572MB (representing ~220 providers) to more dynamic depending on providers in use. - For example, no configuration (no provider requirements) should consume around 10MB, indexed folder w/ `hashicorp/aws` requirement ~70MB. - - Reduced launch time from ~ 2 seconds to 1-3 ms. - -BUG FIXES: - - - fix: Enable IntelliSense for resources & data sources whose name match the provider (e.g. `data`) ([#1072](https://github.com/hashicorp/terraform-ls/pull/1072)) - - state: avoid infinite recursion (surfaced as crash with "goroutine stack exceeds 1000000000-byte limit" message) ([#1084](https://github.com/hashicorp/terraform-ls/pull/1084)) - - decoder: fix race condition in terraform-schema (surfaced as crash with "fatal error: concurrent map read and map write" message) ([#1086](https://github.com/hashicorp/terraform-ls/pull/1086)) - -## 0.29.2 (7 September 2022) - -BUG FIXES: - - - fix: Improve IntelliSense accuracy by tracking provider schema versions (accidentally removed in 0.29.0) ([#1060](https://github.com/hashicorp/terraform-ls/pull/1060)) - - Don't query the Terraform Registry for module sources starting with `.` ([#1062](https://github.com/hashicorp/terraform-ls/pull/1062)) - - fix race condition in schema merging ([terraform-schema#137](https://github.com/hashicorp/terraform-schema/pull/137)) - -INTERNAL: - - - Use Go 1.19 (previously 1.17) to build the server ([#1046](https://github.com/hashicorp/terraform-ls/pull/1046)) - -## 0.29.1 (24 August 2022) - -ENHANCEMENTS: - - - docs: Add link to post explaining vim plugin installation ([#1044](https://github.com/hashicorp/terraform-ls/pull/1044)) - -BUG FIXES: - - - goreleaser: Use correct ldflag (versionPrerelease) when compiling LS ([#1043](https://github.com/hashicorp/terraform-ls/pull/1043)) - - Fix panic on obtaining provider schemas ([#1048](https://github.com/hashicorp/terraform-ls/pull/1048)) - -INTERNAL: - - - cleanup: Remove LogHandler ([#1038](https://github.com/hashicorp/terraform-ls/pull/1038)) - -## 0.29.0 (11 August 2022) - -NOTES / BREAKING CHANGES: - - - settings: `rootModulePaths` option was deprecated and is ignored. Users should instead leverage the workspace LSP API and add the folder to a workspace, if they wish it to be indexed ([#1003](https://github.com/hashicorp/terraform-ls/pull/1003)) - - settings: `excludeModulePaths` option was deprecated in favour of `indexing.ignorePaths`. `excludeModulePaths` is now ignored ([#1003](https://github.com/hashicorp/terraform-ls/pull/1003)) - - settings: `ignoreDirectoryNames` option was deprecated in favour of [`indexing.ignoreDirectoryNames`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#ignoredirectorynames-string). `ignoreDirectoryNames` is now ignored ([#1003](https://github.com/hashicorp/terraform-ls/pull/1003), [#1010](https://github.com/hashicorp/terraform-ls/pull/1010)) - - settings: `terraformExecPath` option was deprecated in favour of [`terraform.path`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#path-string). Old option is now ignored. ([#1011](https://github.com/hashicorp/terraform-ls/pull/1011)) - - settings: `terraformExecTimeout` option was deprecated in favour of [`terraform.timeout`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#timeout-string). Old option is now ignored. ([#1011](https://github.com/hashicorp/terraform-ls/pull/1011)) - - settings: `terraformLogFilePath` option was deprecated in favour of [`terraform.logFilePath`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#logfilepath-string). Old option is now ignored. ([#1011](https://github.com/hashicorp/terraform-ls/pull/1011)) - - cmd/serve: Previously deprecated `-tf-exec*` CLI flags were removed (`-tf-exec`, `-tf-exec-timeout` and `-tf-log-file`) in favour of LSP-based [`terraform.*`](https://github.com/hashicorp/terraform-ls/blob/main/docs/SETTINGS.md#terraform-object-) configuration options ([#1012](https://github.com/hashicorp/terraform-ls/pull/1012)) - -ENHANCEMENTS: - - - Replace internal watcher (used for watching changes in installed plugins and modules) with LSP dynamic capability registration & `workspace/didChangeWatchedFiles`. This should leave to improved performance in most cases. ([#953](https://github.com/hashicorp/terraform-ls/pull/953)) - - Provide completion, hover and docs links for uninitialized Registry modules ([#924](https://github.com/hashicorp/terraform-ls/pull/924)) - - Provide basic IntelliSense (except for diagnostics) for hidden `*.tf` files ([#971](https://github.com/hashicorp/terraform-ls/pull/971)) - - deps: bump terraform-schema to introduce v1.1 `terraform` `cloud` block ([terraform-schema#117](https://github.com/hashicorp/terraform-schema/pull/117)) - - deps: bump terraform-schema to introduce v1.1 `moved` block ([terraform-schema#121](https://github.com/hashicorp/terraform-schema/pull/121)) - - deps: bump terraform-schema to introduce v1.2 `lifecycle` conditions ([terraform-schema#115](https://github.com/hashicorp/terraform-schema/pull/115)) - - deps: bump terraform-schema to introduce v1.2 `lifecycle` `replace_triggered_by` ([terraform-schema#123](https://github.com/hashicorp/terraform-schema/pull/123)) - - Use `module` declarations from parsed configuration as source of truth for `module.calls` ([#987](https://github.com/hashicorp/terraform-ls/pull/987)) - - walker: Index uninitialized modules ([#997](https://github.com/hashicorp/terraform-ls/pull/997)) - - Recognize inputs and outputs of uninitialized local modules ([#598](https://github.com/hashicorp/terraform-ls/issues/598)) - - Enable go to module output declaration from reference ([#1007](https://github.com/hashicorp/terraform-ls/issues/1007)) - - settings: New option [`indexing.ignorePaths`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#ignorepaths-string) was introduced ([#1003](https://github.com/hashicorp/terraform-ls/pull/1003), [#1010](https://github.com/hashicorp/terraform-ls/pull/1010)) - - Introduce `module.terraform` custom LSP command to expose Terraform requirements & version ([#1016](https://github.com/hashicorp/terraform-ls/pull/1016)) - - Avoid obtaining schema via Terraform CLI if the same version is already cached (based on plugin lock file) ([#1014](https://github.com/hashicorp/terraform-ls/pull/1014)) - - Avoid getting version via `terraform version` during background indexing and pick relevant IntelliSense data based on `required_version` constraint ([#1027](https://github.com/hashicorp/terraform-ls/pull/1027)) - - Provide 0.12 based IntelliSense for any <0.12 Terraform versions ([#1027](https://github.com/hashicorp/terraform-ls/pull/1027)) - - Complete module source and version attributes for local and registry modules ([#1024](https://github.com/hashicorp/terraform-ls/pull/1024)) - -BUG FIXES: - - - handlers/command: Return partially parsed metadata from `module.providers` ([#951](https://github.com/hashicorp/terraform-ls/pull/951)) - - fix: Avoid ignoring hidden `*.tfvars` files ([#968](https://github.com/hashicorp/terraform-ls/pull/968)) - - fix: Avoid crash on invalid URIs ([#969](https://github.com/hashicorp/terraform-ls/pull/969)) - - fix: Avoid crash on invalid provider name ([#1030](https://github.com/hashicorp/terraform-ls/pull/1030)) - -INTERNAL: - - - job: introduce explicit priority for jobs ([#977](https://github.com/hashicorp/terraform-ls/pull/977)) - - main: allow build version metadata to be set ([#945](https://github.com/hashicorp/terraform-ls/pull/945)) - - deps: switch to the new minimal `terraform-registry-address` API ([#949](https://github.com/hashicorp/terraform-ls/pull/949)) - - deps: bump LSP structs to match gopls 0.8.4 ([#947](https://github.com/hashicorp/terraform-ls/pull/947)) - - deps: bump github.com/hashicorp/terraform-exec from 0.16.1 to 0.17.0 ([#963](https://github.com/hashicorp/terraform-ls/pull/963)) - - deps: bump github.com/hashicorp/go-version from 1.5.0 to 1.6.0 ([#979](https://github.com/hashicorp/terraform-ls/pull/979)) - - indexer: refactor & improve/cleanup error handling ([#988](https://github.com/hashicorp/terraform-ls/pull/988)) - - indexer/walker: Avoid running jobs where not needed ([#1006](https://github.com/hashicorp/terraform-ls/pull/1006)) - -## 0.28.1 (9 June 2022) - -Due to some release pipeline changes and multiple release attempts, `0.28.0` release was published with checksums mismatching the release artifacts. - -This release is therefore equivalent to `v0.28.0`, but published with the correct checksums. - -## 0.28.0 (7 June 2022) - -ENHANCEMENTS: - - Link to documentation from module source for registry modules ([#874](https://github.com/hashicorp/terraform-ls/pull/874)) - - Provide refresh mechanism for `module.providers` when providers change ([#902](https://github.com/hashicorp/terraform-ls/pull/902)) - - Provide refresh mechanism for `module.calls` when module calls change ([#909](https://github.com/hashicorp/terraform-ls/pull/909)) - - Add support for `workspace/didChangeWatchedFiles` notifications for `*.tf` & `*.tfvars` ([#790](https://github.com/hashicorp/terraform-ls/pull/790)) - - Improve performance by reducing amount of notifications sent for any single module changes ([#931](https://github.com/hashicorp/terraform-ls/pull/931)) - -BUG FIXES: - - Ignore duplicate document versions in `textDocument/didChange` ([#940](https://github.com/hashicorp/terraform-ls/pull/940)) - -INTERNAL: - - build(deps): bump github.com/mitchellh/cli from 1.1.2 to 1.1.3 ([#886](https://github.com/hashicorp/terraform-ls/pull/886)) - - Use `terraform-registry-address` for parsing module sources ([#891](https://github.com/hashicorp/terraform-ls/pull/891)) - - Add utm parameters to docs links in `module.*` commands ([#923](https://github.com/hashicorp/terraform-ls/pull/923)) - -## 0.27.0 (14 April 2022) - -NOTES / BREAKING CHANGES: - - - langserver/handlers/command: Remove `rootmodules` command ([#846](https://github.com/hashicorp/terraform-ls/pull/846)) - - cmd: Remove `completion` CLI command ([#852](https://github.com/hashicorp/terraform-ls/pull/852)) - -ENHANCEMENTS: - - - Provide (opt-in) custom semantic tokens & modifiers ([#833](https://github.com/hashicorp/terraform-ls/pull/833)) - - Enable 'go to module source' for local modules (via [#849](https://github.com/hashicorp/terraform-ls/pull/849)) - - Enable opening a single Terraform file ([#843](https://github.com/hashicorp/terraform-ls/pull/843)) - -BUG FIXES: - - - Avoid hanging when workspace contains >50 folders ([#839](https://github.com/hashicorp/terraform-ls/pull/839)) - - Make loading of parent directory after lower level directories work ([#851](https://github.com/hashicorp/terraform-ls/pull/851)) - - Fix corrupted diffs in formatting responses ([#876](https://github.com/hashicorp/terraform-ls/pull/876)) - - Fix `module.calls` command for Registry modules installed by Terraform v1.1+ ([#872](https://github.com/hashicorp/terraform-ls/pull/872)) - -INTERNAL: - - - Add job scheduler benchmarks & document [expectations around performance](https://github.com/hashicorp/terraform-ls/blob/v0.27.0/docs/benchmarks.md) ([#840](https://github.com/hashicorp/terraform-ls/pull/840)) - -## 0.26.0 (17 March 2022) - -ENHANCEMENTS: - - - Introduce go-to-variable from `tfvars` files ([#727](https://github.com/hashicorp/terraform-ls/pull/727)) - - Automatically refresh semantic tokens for more reliable highlighting ([#630](https://github.com/hashicorp/terraform-ls/pull/630)) - - Enhance semantic highlighting of block labels ([#802](https://github.com/hashicorp/terraform-ls/pull/802)) - - Enable completion, hover, go-to-definition/reference etc. for Terraform Registry modules ([#808](https://github.com/hashicorp/terraform-ls/pull/808)) - - Report dependent semantic highlighting modifiers as `defaultLibrary` (instead of `modification`) ([#817](https://github.com/hashicorp/terraform-ls/pull/817)) - - Semantically highlight type declarations in variable `type` ([#827](https://github.com/hashicorp/terraform-ls/pull/827)) - -BUG FIXES: - - - Address race conditions typically surfaced as "out of range" errors, lack of completion/hover/etc. data or data associated with wrong position within the document ([#782](https://github.com/hashicorp/terraform-ls/pull/782)) - - Fix broken validate on save ([#799](https://github.com/hashicorp/terraform-ls/pull/799)) - - Fix encoding of unknown semantic token types ([#815](https://github.com/hashicorp/terraform-ls/pull/815)) - - Fix missing references for some blocks in a separate config file ([#829](https://github.com/hashicorp/terraform-ls/pull/829)) - -INTERNAL: - - - Simplify module source detection in favour of faster CI/compilation times ([#783](https://github.com/hashicorp/terraform-ls/pull/783)) - - Store documents in a memdb-backed table ([#771](https://github.com/hashicorp/terraform-ls/pull/771)) - - Refactor job scheduler to use memdb for jobs ([#782](https://github.com/hashicorp/terraform-ls/pull/782)) - - build(deps): bump github.com/creachadair/jrpc2 from 0.35.2 to 0.37.0 ([#774](https://github.com/hashicorp/terraform-ls/pull/774), [#795](https://github.com/hashicorp/terraform-ls/pull/795), [#809](https://github.com/hashicorp/terraform-ls/pull/809)) - -## 0.25.2 (11 January 2022) - -BUG FIXES: - - - fix: avoid sending empty diagnostics ([#756](https://github.com/hashicorp/terraform-ls/pull/756)) - - fix: avoid code lens updates when disabled ([#757](https://github.com/hashicorp/terraform-ls/pull/757)) - - fix: Catch OS agnostic interrupt signal ([#755](https://github.com/hashicorp/terraform-ls/pull/755)) - - fix: Return correct target selection range for definition/declaration ([#759](https://github.com/hashicorp/terraform-ls/pull/759)) - - telemetry: Only send requests if data has changed ([#758](https://github.com/hashicorp/terraform-ls/pull/758)) - -INTERNAL: - - - Switch to hc-install from tfinstall ([#737](https://github.com/hashicorp/terraform-ls/pull/737)) - -## 0.25.1 (6 January 2022) - -BUG FIXES: - - - Reduce parallelism for background operations to flatten CPU spikes triggered by workspaces with many modules on machines w/ >2 CPUs (which would previously had higher parallelism) ([#752](https://github.com/hashicorp/terraform-ls/pull/752)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.32.0 to 0.35.2 ([#748](https://github.com/hashicorp/terraform-ls/pull/748)) - - build(deps): bump github.com/spf13/afero from 1.6.0 to 1.8.0 ([#747](https://github.com/hashicorp/terraform-ls/pull/747), [#754](https://github.com/hashicorp/terraform-ls/pull/754)) - - build(deps): bump github.com/mitchellh/mapstructure from 1.4.2 to 1.4.3 ([#732](https://github.com/hashicorp/terraform-ls/pull/732)) - - build(deps): bump github.com/hashicorp/hcl/v2 from 2.10.1 to 2.11.1 ([#731](https://github.com/hashicorp/terraform-ls/pull/731)) - -## 0.25.0 (2 December 2021) - -ENHANCEMENTS: - - - Introduce `module.providers` command ([#712](https://github.com/hashicorp/terraform-ls/pull/712)) - - Diagnostics for all known modules/files are now published automatically (as opposed to just open files) ([#714](https://github.com/hashicorp/terraform-ls/pull/714)) - - Introduce go-to-variable from module input name ([#700](https://github.com/hashicorp/terraform-ls/pull/700)) - -NOTES: - - - Diagnostics for non-autoloaded `*.tfvars` are no longer published, see [#715](https://github.com/hashicorp/terraform-ls/issues/715) for more details ([#714](https://github.com/hashicorp/terraform-ls/pull/714)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.30.1 to 0.32.0 ([#713](https://github.com/hashicorp/terraform-ls/pull/713), [#728](https://github.com/hashicorp/terraform-ls/pull/728)) - - Avoid duplicate state entries (by avoiding symlink evaluation) ([#699](https://github.com/hashicorp/terraform-ls/pull/699)) - -## 0.24.0 (10 November 2021) - -BREAKING CHANGES: - - - `source.formatAll.terraform-ls` is renamed to `source.formatAll.terraform` to follow other similar existing actions in the wild ([#680](https://github.com/hashicorp/terraform-ls/pull/680)) - -ENHANCEMENTS: - - - Implement opt-in telemetry (documented in [`docs/telemetry.md`](https://github.com/hashicorp/terraform-ls/blob/v0.24.0/docs/telemetry.md)) ([#681](https://github.com/hashicorp/terraform-ls/pull/681)) - - Provide workspace-wide symbols for variables in `*.tfvars` ([#658](https://github.com/hashicorp/terraform-ls/issues/658)) - - Go-to-definition now highlights just the definition of a block/attribute instead of the whole attribute/block ([#689](https://github.com/hashicorp/terraform-ls/pull/689)) - - Add configuration option allowing to exclude directories from being indexed upon initialization ([#696](https://github.com/hashicorp/terraform-ls/pull/696)) - - Parse `*.tfvars.json` for workspace-wide symbols and diagnostics ([#697](https://github.com/hashicorp/terraform-ls/pull/697)) - -BUG FIXES: - - - The server announces just a single formatting code action, other actions `source`, `source.fixAll` and `source.formatAll` are removed which helps avoid running the same action multiple times and better follows conventions ([#680](https://github.com/hashicorp/terraform-ls/pull/680)) - - Requesting `Only: []` code actions is now no-op ([#680](https://github.com/hashicorp/terraform-ls/pull/680)) - - Fix indexing of references in dependent modules ([#698](https://github.com/hashicorp/terraform-ls/pull/698)) - - Fix workspace folder removal/addition at runtime ([#707](https://github.com/hashicorp/terraform-ls/pull/707)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.28.0 to 0.30.0 ([#683](https://github.com/hashicorp/terraform-ls/pull/683), [#684](https://github.com/hashicorp/terraform-ls/pull/684), [#686](https://github.com/hashicorp/terraform-ls/pull/686)) - -## 0.23.0 (14 October 2021) - -ENHANCEMENTS: - - - Introduce `module.calls` command ([#632](https://github.com/hashicorp/terraform-ls/pull/632)) - - Introduce experimental completion of required fields. You can opt in via [`prefillRequiredFields` option](https://github.com/hashicorp/terraform-ls/blob/v0.23.0/docs/SETTINGS.md#experimentalfeaturesprefillrequiredfields) ([#657](https://github.com/hashicorp/terraform-ls/pull/657)) - - Ignore `.terragrunt-cache` when indexing initialized modules ([#666](https://github.com/hashicorp/terraform-ls/pull/666)) - - Parse `*.tf.json` for references and symbols ([#672](https://github.com/hashicorp/terraform-ls/pull/672)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.25.1 to 0.28.0 ([#649](https://github.com/hashicorp/terraform-ls/pull/649), [#650](https://github.com/hashicorp/terraform-ls/pull/650), [#662](https://github.com/hashicorp/terraform-ls/pull/662), [#668](https://github.com/hashicorp/terraform-ls/pull/668), [#676](https://github.com/hashicorp/terraform-ls/pull/676), [#677](https://github.com/hashicorp/terraform-ls/pull/677)) - - build(deps): bump github.com/hashicorp/terraform-exec from 0.14.0 to 0.15.0 ([#664](https://github.com/hashicorp/terraform-ls/pull/664)) - -## 0.22.0 (16 September 2021) - -ENHANCEMENTS: - - - Support standalone (not autoloaded) `*.tfvars` files ([#621](https://github.com/hashicorp/terraform-ls/pull/621)) - -BUG FIXES: - - - fix: Limit label completion items to 100 (same as limit for completion items in other contexts) ([#628](https://github.com/hashicorp/terraform-ls/pull/628)) - - Recognize references in module block inputs ([#623](https://github.com/hashicorp/terraform-ls/pull/623)) - -INTERNAL: - - - build(deps): bump github.com/mitchellh/mapstructure from 1.4.1 to 1.4.2 ([#641](https://github.com/hashicorp/terraform-ls/pull/641)) - - build(deps): bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.1 ([#629](https://github.com/hashicorp/terraform-ls/pull/629)) - - build(deps): bump github.com/creachadair/jrpc2 from 0.20.0 to 0.25.0 ([#631](https://github.com/hashicorp/terraform-ls/pull/631), [#636](https://github.com/hashicorp/terraform-ls/pull/636), [#638](https://github.com/hashicorp/terraform-ls/pull/638), [#640](https://github.com/hashicorp/terraform-ls/pull/640), [#642](https://github.com/hashicorp/terraform-ls/pull/642)) - -## 0.21.0 (23 August 2021) - -DEPRECATIONS: - - - `-tf-exec` (CLI flag) is deprecated in favour of LSP config option [`terraformExecPath`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformexecpath-string). `-tf-exec` flag will raise warnings in future releases and will be eventually removed. ([#588](https://github.com/hashicorp/terraform-ls/pull/588)) - - `-tf-log-file` (CLI flag) is deprecated in favour of LSP config option [`terraformLogFilePath`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformlogfilepath-string). `-tf-log-file` flag will raise warnings in future releases and will be eventually removed. ([#619](https://github.com/hashicorp/terraform-ls/pull/619)) - - `tf-exec-timeout` (CLI flag) is deprecated in favour of LSP config option [`terraformExecTimeout`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformexectimeout-string). `tf-exec-timeout` flag will raise warnings in future releases and will be eventually removed. ([#619](https://github.com/hashicorp/terraform-ls/pull/619)) - -BUG FIXES: - - - fix: allow multiple variable validation blocks ([#610](https://github.com/hashicorp/terraform-ls/pull/610)) - - fix: avoid crash on missing block label ([#612](https://github.com/hashicorp/terraform-ls/pull/612)) - - fix: avoid crash when `validate` command returns internal error instead of diagnostics ([#588](https://github.com/hashicorp/terraform-ls/pull/588)) - -ENHANCEMENTS: - - - Always validate URI schema ([#602](https://github.com/hashicorp/terraform-ls/pull/602)) - - Introduce [`terraformExecPath`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformexecpath-string) as option within `initializationOptions` ([#588](https://github.com/hashicorp/terraform-ls/pull/588)) - - Introduce [`terraformLogFilePath`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformlogfilepath-string) as option within `initializationOptions` ([#619](https://github.com/hashicorp/terraform-ls/pull/619)) - - Introduce [`terraformExecTimeout`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformexectimeout-string) as option within `initializationOptions` ([#619](https://github.com/hashicorp/terraform-ls/pull/619)) - - Introduce format on save code action ([#625](https://github.com/hashicorp/terraform-ls/pull/625)) - -INTERNAL: - - - Update LSP structs to gopls' `0.7.0` ([#608](https://github.com/hashicorp/terraform-ls/pull/608)) - - build(deps): bump github.com/creachadair/jrpc2 from 0.19.1 to 0.20.0 ([#614](https://github.com/hashicorp/terraform-ls/pull/614)) - - build(deps): bump github.com/zclconf/go-cty from 1.9.0 to 1.9.1 ([#624](https://github.com/hashicorp/terraform-ls/pull/624)) - -## 0.20.1 (3 August 2021) - -BUG FIXES: - - - fix: recognize references in common nested expressions ([#596](https://github.com/hashicorp/terraform-ls/pull/596)) - - textDocument/publishDiagnostics: Publish any source-less warnings or errors ([#601](https://github.com/hashicorp/terraform-ls/pull/601)) - - fix: avoid publishing stale 'validate' diagnostics ([#603](https://github.com/hashicorp/terraform-ls/pull/603)) - - fix: avoid crash on highlighting unknown tuple element ([#605](https://github.com/hashicorp/terraform-ls/pull/605)) - - fix: recognize list(object) and set(object) attributes as blocks ([#607](https://github.com/hashicorp/terraform-ls/pull/607)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.19.0 to 0.19.1 ([#606](https://github.com/hashicorp/terraform-ls/pull/606)) - -## 0.20.0 (29 July 2021) - -FEATURES: - - - Implement reference count code lens ([#584](https://github.com/hashicorp/terraform-ls/pull/584)) - -ENHANCEMENTS: - - - Add support for module input completion/hover/highlighting ([#551](https://github.com/hashicorp/terraform-ls/pull/551)) - - Add support for module output reference completion/hover/highlighting ([#593](https://github.com/hashicorp/terraform-ls/pull/593)) - -BUG FIXES: - - - fix: recognize references in lists and other complex types ([#594](https://github.com/hashicorp/terraform-ls/pull/594)) - -INTERNAL: - - - build(deps): bump github.com/hashicorp/hcl/v2 from 2.10.0 to 2.10.1 ([#589](https://github.com/hashicorp/terraform-ls/pull/589)) - -## 0.19.1 (20 July 2021) - -BUG FIXES: - - - Fix 'go to references' for resources & data sources ([#587](https://github.com/hashicorp/terraform-ls/pull/587)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.17.0 to 0.18.0 ([#550](https://github.com/hashicorp/terraform-ls/pull/550)) - -## 0.19.0 (8 July 2021) - -FEATURES: - - - Go to attribute/block from reference ([#569](https://github.com/hashicorp/terraform-ls/pull/569)) - - Go to references from an attribute or a block ([#572](https://github.com/hashicorp/terraform-ls/pull/572), [#580](https://github.com/hashicorp/terraform-ls/pull/580)) - -ENHANCEMENTS: - - - Support multiple folders natively ([#502](https://github.com/hashicorp/terraform-ls/pull/502)) - - Make references scope & type aware ([#582](https://github.com/hashicorp/terraform-ls/pull/582)) - -BUG FIXES: - - - fix: avoid crash on empty file formatting ([#578](https://github.com/hashicorp/terraform-ls/pull/578)) - -## 0.18.3 (2 July 2021) - -BUG FIXES: - - - fix: avoid circular references to list/map/object attributes (which caused high CPU usage on copy) ([#575](https://github.com/hashicorp/terraform-ls/pull/575)) - -## 0.18.2 (1 July 2021) - -ENHANCEMENTS: - - - Provide (less verbose) step-based completion ([#566](https://github.com/hashicorp/terraform-ls/pull/566)) - -BUG FIXES: - - - Mock out code lens support to avoid errors ([#561](https://github.com/hashicorp/terraform-ls/pull/561)) - -## 0.18.1 (17 June 2021) - -ENHANCEMENTS: - - - Support for references to variables and locals ([#553](https://github.com/hashicorp/terraform-ls/pull/553)) - - tfvars: Infer variable types from default values where not explicitly specified ([#554](https://github.com/hashicorp/terraform-ls/pull/554)) - -BUG FIXES: - - - Prevent var names from being completed in label ([#555](https://github.com/hashicorp/terraform-ls/pull/555)) - -## 0.18.0 (10 June 2021) - -FEATURES: - - - Add support for `tfvars` (variable files) ([#540](https://github.com/hashicorp/terraform-ls/pull/540)) - -ENHANCEMENTS: - - - Add support for state backends ([#544](https://github.com/hashicorp/terraform-ls/pull/544)) - - Add support for provisioners ([#542](https://github.com/hashicorp/terraform-ls/pull/542)) - - Support for type declarations (variable `type`) ([#490](https://github.com/hashicorp/terraform-ls/pull/490)) - - Support variable `default` ([#543](https://github.com/hashicorp/terraform-ls/pull/543)) - -## 0.17.1 (26 May 2021) - -BUG FIXES: - - - Reduce CPU usage via custom Copy methods instead reflection ([#513](https://github.com/hashicorp/terraform-ls/pull/513)) - -## 0.17.0 (20 May 2021) - -ENHANCEMENTS: - - - Add support for traversals/references ([#485](https://github.com/hashicorp/terraform-ls/pull/485)) - - Add new `module.callers` (LSP) command & [document all available commands](https://github.com/hashicorp/terraform-ls/blob/41d49b3/docs/commands.md) ([#508](https://github.com/hashicorp/terraform-ls/pull/508)) - -## 0.16.3 (13 May 2021) - -ENHANCEMENTS: - - - Increase request concurrency & make it configurable via `-req-concurrency` flag of `serve` command ([#489](https://github.com/hashicorp/terraform-ls/pull/489)) - -BUG FIXES: - - - Fix request cancellation ([#314](https://github.com/hashicorp/terraform-ls/issues/314)) - -## 0.16.2 (11 May 2021) - -ENHANCEMENTS: - - - Support templated paths for `-cpuprofile` & `-memprofile` flags of `serve` ([#501](https://github.com/hashicorp/terraform-ls/pull/501)) - -BUG FIXES: - - - Avoid presenting stale diagnostics after document changes ([#488](https://github.com/hashicorp/terraform-ls/pull/488)) - -## 0.16.1 (30 April 2021) - -BUG FIXES: - - - Prevent crash for legacy provider lookups where configuration is missing `terraform`>`required_providers` block or `source` arguments for providers and Terraform 0.13+ is used ([#481](https://github.com/hashicorp/terraform-ls/pull/481)) - -## 0.16.0 (29 April 2021) - -**SECURITY:** - -This release is signed with a new GPG key (ID `72D7468F`), unlike all previous releases which were signed with (now revoked) key (ID `348FFC4C`). Old releases were *temporarily* re-signed with the new key, but that key will be removed in coming weeks or months. - -[Read more about the related security event HCSEC-2021-12](https://discuss.hashicorp.com/t/hcsec-2021-12-codecov-security-event-and-hashicorp-gpg-key-exposure/23512/2). - -Users of the [Terraform VS Code extension](https://github.com/hashicorp/vscode-terraform) will need to upgrade to [`2.10.1`](https://github.com/hashicorp/vscode-terraform/blob/v2.10.1/CHANGELOG.md#2101-2021-04-28) before auto-upgrading to this LS version. - - -ENHANCEMENTS: - - - Allow effective utilization of multiple schema sources (local or preloaded) via cache ([#454](https://github.com/hashicorp/terraform-ls/issues/454)) - - _"No schema found ..."_ warning removed, as schema is far more likely to be available now ([#454](https://github.com/hashicorp/terraform-ls/issues/454)) - - _"Alternative root modules found ..."_ warning removed ([#454](https://github.com/hashicorp/terraform-ls/issues/454)) - - Further improve support for Terraform 0.15 ([#425](https://github.com/hashicorp/terraform-ls/issues/425)) - -BUG FIXES: - - - Fix panic caused by partially unknown map keys in configuration ([#447](https://github.com/hashicorp/terraform-ls/issues/447)) - -## 0.15.0 (12 March 2021) - -FEATURES: - - - Add workspace-wide symbol navigation ([#427](https://github.com/hashicorp/terraform-ls/pull/427)) - -ENHANCEMENTS: - - - textDocument/documentSymbol: Support nested symbols ([#420](https://github.com/hashicorp/terraform-ls/pull/420)) - - Add Go version, OS and architecture to `version` command ([#407](https://github.com/hashicorp/terraform-ls/pull/407)) - - Add initial support for expressions ([#411](https://github.com/hashicorp/terraform-ls/pull/411)) - - Reflect 0.15 schema changes ([#436](https://github.com/hashicorp/terraform-ls/pull/436)) - -BUILD: - - - Provide Linux packages ([#421](https://github.com/hashicorp/terraform-ls/pull/421)) - -## 0.14.0 (23 February 2021) - -FEATURES: - - - Add links to documentation (Ctrl+click in supported clients + hover) ([#402](https://github.com/hashicorp/terraform-ls/pull/402)) - -ENHANCEMENTS: - - - Improve messaging when Terraform is not found ([#401](https://github.com/hashicorp/terraform-ls/pull/401)) - -BUG FIXES: - - - watcher: Refresh versions when plugin lockfile changes ([#403](https://github.com/hashicorp/terraform-ls/pull/403)) - -BUILD: - - - Provide darwin/arm64 (Apple Silicon) build ([#350](https://github.com/hashicorp/terraform-ls/pull/350)) - -## 0.13.0 (5 February 2021) - -FEATURES: - - - watcher: Detect `terraform init` from scratch ([#385](https://github.com/hashicorp/terraform-ls/pull/385)) - -ENHANCEMENTS: - - - cmd: Introduce version JSON output ([#386](https://github.com/hashicorp/terraform-ls/pull/386)) - - Utilize CPU better when loading modules ([#391](https://github.com/hashicorp/terraform-ls/pull/391)) - -BUG FIXES: - - - Fix miscalculated semantic tokens ([#390](https://github.com/hashicorp/terraform-ls/pull/390)) - -## 0.12.1 (12 January 2021) - -BUG FIXES: - - - Print help (and version) to stdout ([#296](https://github.com/hashicorp/terraform-ls/pull/296)) - - Fix broken executable `validate` command ([#373](https://github.com/hashicorp/terraform-ls/pull/373)) - -## 0.12.0 (6 January 2021) - -FEATURES: - - - Implement `textDocument/semanticTokens` (semantic highlighting) ([#331](https://github.com/hashicorp/terraform-ls/pull/331)) - - Implement experimental validate on save feature ([#340](https://github.com/hashicorp/terraform-ls/pull/340)) - -ENHANCEMENTS: - - - Report progress for validate command ([#336](https://github.com/hashicorp/terraform-ls/pull/336)) - - Report deprecated completion items as such ([#337](https://github.com/hashicorp/terraform-ls/pull/337)) - - Preloaded schemas now include partner providers in addition to official ones ([#341](https://github.com/hashicorp/terraform-ls/pull/341)) - -NOTES: - - - Only official (legacy) providers will be completed in `provider` block completion. Partner providers currently require corresponding entry in `required_providers` block, read https://github.com/hashicorp/terraform-ls/issues/370 to understand why and how we plan to address this inconvenient behaviour. - - Preloaded schemas are now being generated at release time (as opposed to being committed to the repo). Therefore availability of these schemas is dependent on particular release process [tracked in this repository](https://github.com/hashicorp/terraform-ls/blob/main/.github/workflows/release.yml). This may interest anyone who does not use the official builds from `releases.hashicorp.com` and has its own build process. Plain `go get` still compiles and runs server correctly, however it won't automatically generate and embed the schemas. ([#341](https://github.com/hashicorp/terraform-ls/pull/341)) - -INTERNAL: - - - Use Go `1.15.2` (previously `1.14.9`) ([#348](https://github.com/hashicorp/terraform-ls/pull/348)) - - Provide package for linux/arm64 ([#351](https://github.com/hashicorp/terraform-ls/pull/351)) - -## 0.11.0 (9 December 2020) - -ENHANCEMENTS: - - - Ask for init if current folder is empty root module ([#257](https://github.com/hashicorp/terraform-ls/pull/257)) - - Display provider versions in completion/hover detail ([#329](https://github.com/hashicorp/terraform-ls/pull/329)) - - Expose `terraform.validate` as command for language clients ([#323](https://github.com/hashicorp/terraform-ls/pull/323)) - - Expose `terraform.init` as command for language clients ([#325](https://github.com/hashicorp/terraform-ls/pull/325)) - - Add human readable name to `rootmodules` command API ([#332](https://github.com/hashicorp/terraform-ls/pull/332)) - - Expose server version via LSP ([#318](https://github.com/hashicorp/terraform-ls/pull/318)) - -BUG FIXES: - - - Avoid crashing when no hover data is available for a position ([#320](https://github.com/hashicorp/terraform-ls/pull/320)) - -INTERNAL: - - - Replace `sourcegraph/go-lsp` with gopls' `internal/lsp/protocol` ([#311](https://github.com/hashicorp/terraform-ls/pull/311)) - -## 0.10.0 (19 November 2020) - -FEATURES: - - - Support module wide diagnostics ([#288](https://github.com/hashicorp/terraform-ls/pull/288)) - - Provide documentation on hover ([#294](https://github.com/hashicorp/terraform-ls/pull/294)) - -ENHANCEMENTS: - - - Add support for upcoming Terraform v0.14 ([#289](https://github.com/hashicorp/terraform-ls/pull/289)) - - completion: Prompt picking type of provider/data/resource automatically ([#300](https://github.com/hashicorp/terraform-ls/pull/300)) - - completion/hover: Preload official providers to improve UX for uninitialized modules ([#302](https://github.com/hashicorp/terraform-ls/pull/302)) - -BUG FIXES: - - - textDocument/completion: Fix wrong range computation near EOF ([#298](https://github.com/hashicorp/terraform-ls/pull/298)) - - Avoid ignoring schema for uninitialized module ([#301](https://github.com/hashicorp/terraform-ls/pull/301)) - - fix synchronization issues affecting any clients which support partial updates ([#304](https://github.com/hashicorp/terraform-ls/pull/304)) - - Avoid panic by initing universal schema early ([#307](https://github.com/hashicorp/terraform-ls/pull/307)) - -INTERNAL: - -- Bump jrpc2 (JSON-RPC library) to latest version ([#309](https://github.com/hashicorp/terraform-ls/pull/309)) - -## 0.9.0 (10 November 2020) - -FEATURES: - - - Support for `workspace/executeCommand` with new `rootmodules` inspection command ([#274](https://github.com/hashicorp/terraform-ls/pull/274)) - - Provide version-aware schema for completion of "core" blocks ([#287](https://github.com/hashicorp/terraform-ls/pull/287)) - - `locals`, `module`, `output`, `variable` and `terraform` - - enrichment of `data`, `provider` and `resource` schemas by meta-arguments, such as `count` or `for_each` - -ENHANCEMENTS: - - - Limited completion is available as soon as the server starts and is progressively enhanced as more (core or provider) schema is discovered ([#281](https://github.com/hashicorp/terraform-ls/pull/281)) - - Symbols are available as soon as the server starts ([#281](https://github.com/hashicorp/terraform-ls/pull/281)) - -BUG FIXES: - - - Prevent command collisions for clients such as VS Code with `commandPrefix` init option ([#279](https://github.com/hashicorp/terraform-ls/pull/279)) - -INTERNAL: - - - Internal decoder decoupled into `hashicorp/hcl-lang` ([#281](https://github.com/hashicorp/terraform-ls/pull/281)) - - Schema handling decoupled into `hashicorp/terraform-schema` ([#281](https://github.com/hashicorp/terraform-ls/pull/281)) - -## 0.8.0 (9 October 2020) - -FEATURES: - - - HCL diagnostics support ([#269](https://github.com/hashicorp/terraform-ls/pull/269)) - -BUG FIXES: - - - fix: prevent crash when listing symbols in invalid config ([#273](https://github.com/hashicorp/terraform-ls/pull/273)) - -INTERNAL: - - - Replace most of `internal/terraform/exec` with [`hashicorp/terraform-exec`](https://github.com/hashicorp/terraform-exec) ([#271](https://github.com/hashicorp/terraform-ls/pull/271)) - -## 0.7.0 (2 September 2020) - -FEATURES: - - - Document Symbol support ([#265](https://github.com/hashicorp/terraform-ls/pull/265)) - -## 0.6.1 (18 August 2020) - -BUG FIXES: - - - Reduce logging of module loading ([#259](https://github.com/hashicorp/terraform-ls/pull/259)) - - Update jrpc2 to fix cancelRequest deadlock ([#260](https://github.com/hashicorp/terraform-ls/pull/260)) - -## 0.6.0 (10 August 2020) - -FEATURES: - - - New command: `inspect-module` to help debugging root module discovery issues ([#231](https://github.com/hashicorp/terraform-ls/pull/231)) - -ENHANCEMENTS: - - - Support 0.13 provider identities ([#255](https://github.com/hashicorp/terraform-ls/pull/255)) - - settings: Support relative paths to root modules ([#246](https://github.com/hashicorp/terraform-ls/pull/246)) - - settings: Expand `~` in root module paths ([#247](https://github.com/hashicorp/terraform-ls/pull/247)) - - settings: Add support for `excludeModulePaths` ([#251](https://github.com/hashicorp/terraform-ls/pull/251)) - - handlers/initialize: Skip invalid root module paths ([#248](https://github.com/hashicorp/terraform-ls/pull/248)) - - Cap parallel root module loading (to reduce CPU usage) ([#256](https://github.com/hashicorp/terraform-ls/pull/256)) - -INTERNAL: - - - internal/filesystem: Integrate spf13/afero ([#249](https://github.com/hashicorp/terraform-ls/pull/249)) - - deps: Bump creachadair/jrpc2 to latest (0.10.0) ([#253](https://github.com/hashicorp/terraform-ls/pull/253)) - -## 0.5.4 (22 July 2020) - -BUG FIXES: - - - terraform/schema: Make schema storage version-aware (0.13 compatible) ([#243](https://github.com/hashicorp/terraform-ls/pull/243)) - -INTERNAL: - - - Improve root module discovery error handling ([#244](https://github.com/hashicorp/terraform-ls/pull/244)) - -## 0.5.3 (21 July 2020) - -BUG FIXES: - - - fix: Append EOF instead of newline (prevent CPU spike) ([#239](https://github.com/hashicorp/terraform-ls/pull/239)) - -## 0.5.2 (16 July 2020) - -BUG FIXES: - - - fix: Prevent parsing invalid tokens which would cause CPU spike ([#236](https://github.com/hashicorp/terraform-ls/pull/236)) - -INTERNAL: - - - rootmodule: log errors after loading is finished ([#229](https://github.com/hashicorp/terraform-ls/pull/229)) - -## 0.5.1 (10 July 2020) - -BUG FIXES: - - - Fixes bug which broke schema obtaining due to `-no-color` at unsupported position ([#227](https://github.com/hashicorp/terraform-ls/pull/227)) - -## 0.5.0 (10 July 2020) - -ENHANCEMENTS: - - - Introduce CPU & memory profiling ([#223](https://github.com/hashicorp/terraform-ls/pull/223)) - - Pass `-no-color` to terraform ([#208](https://github.com/hashicorp/terraform-ls/pull/208)) - - settings: Make root modules configurable ([#198](https://github.com/hashicorp/terraform-ls/pull/198)) - -BUG FIXES: - - - terraform/rootmodule: Make walker async by default ([#196](https://github.com/hashicorp/terraform-ls/pull/196)) - - refactor: asynchronous loading of root module parts ([#219](https://github.com/hashicorp/terraform-ls/pull/219)) - - Enable formatting for older Terraform versions (<0.12) ([#219](https://github.com/hashicorp/terraform-ls/pull/219)) - - Gate formatting capability on v0.7.7+ ([#220](https://github.com/hashicorp/terraform-ls/pull/220)) - -## 0.4.1 (3 July 2020) - -BUG FIXES: - - - Make volume comparison case-insensitive on Windows ([#199](https://github.com/hashicorp/terraform-ls/pull/199)) - -## 0.4.0 (25 June 2020) - -FEATURES: - - - Walk hierarchy to add root modules ([#176](https://github.com/hashicorp/terraform-ls/pull/176)) - -ENHANCEMENTS: - - - terraform: Introduce experimental support for 0.13 version ([#149](https://github.com/hashicorp/terraform-ls/pull/149)) - - Treat schema availability as not essential ([#171](https://github.com/hashicorp/terraform-ls/pull/171)) - - Make formatting work regardless of initialization state ([#178](https://github.com/hashicorp/terraform-ls/pull/178)) - -BUG FIXES: - - - fix detection of single file during initialization ([#172](https://github.com/hashicorp/terraform-ls/pull/172)) - -## 0.3.2 (5 June 2020) - -BUG FIXES: - - - fix: os.Environ() returns KEY=val, not just keys (fix of a bug that was introduced in 0.3.1) ([#143](https://github.com/hashicorp/terraform-ls/pull/143)) - -## 0.3.1 (5 June 2020) - -BUG FIXES: - - - terraform/exec: Pass through all environment variables ([#139](https://github.com/hashicorp/terraform-ls/pull/139)) - -## 0.3.0 (4 June 2020) - -FEATURES: - - - textDocument/complete: Complete first level keywords ([#104](https://github.com/hashicorp/terraform-ls/pull/104)) - - Add ability to specify path to Terraform binary ([#109](https://github.com/hashicorp/terraform-ls/pull/109)) - - Make Terraform exec timeout configurable ([#134](https://github.com/hashicorp/terraform-ls/pull/134)) - -ENHANCEMENTS: - - - Improve UX of completion items ([#115](https://github.com/hashicorp/terraform-ls/pull/115)) - - Add support for autocomplete based on a prefix ([#119](https://github.com/hashicorp/terraform-ls/pull/119)) - - textDocument/complete: Use isIncomplete for >100 items ([#132](https://github.com/hashicorp/terraform-ls/pull/132)) - - textDocument/complete: Pass TextEdit instead of static text ([#133](https://github.com/hashicorp/terraform-ls/pull/133)) - -INTERNAL: - - - refactoring(parser): Pass around tokens instead of blocks ([#125](https://github.com/hashicorp/terraform-ls/pull/125)) - - langserver: Make requests sequential ([#120](https://github.com/hashicorp/terraform-ls/pull/120)) - - Support partial updates ([#103](https://github.com/hashicorp/terraform-ls/pull/103)) - - Support simplified building ([#98](https://github.com/hashicorp/terraform-ls/pull/98)) - -## 0.2.1 (19 May 2020) - -BUG FIXES: - - - context: Refactor and fix duplicate key ([#86](https://github.com/hashicorp/terraform-ls/pull/86)) - -INTERNAL: - - - build: Sign archives checksum ([#99](https://github.com/hashicorp/terraform-ls/pull/99)) - - build: Publish artifacts to releases.hashicorp.com ([#102](https://github.com/hashicorp/terraform-ls/pull/102)) - -## 0.2.0 (7 May 2020) - -FEATURES: - - - Add support for formatting (via `terraform fmt`) ([#51](https://github.com/hashicorp/terraform-ls/pull/51)) - - Add support for completing labels ([#58](https://github.com/hashicorp/terraform-ls/pull/58)) - -BUG FIXES: - - - Fix URI parsing for Windows paths ([#73](https://github.com/hashicorp/terraform-ls/pull/73)) - - terraform/exec: Make server work under non-admin users on Windows ([#78](https://github.com/hashicorp/terraform-ls/pull/78)) - -INTERNAL: - - - MacOS and Windows binaries are now signed ([#48](https://github.com/hashicorp/terraform-ls/pull/46)) - - Use Go 1.14.1 (previously `1.13.8`) ([#46](https://github.com/hashicorp/terraform-ls/pull/46)) - -## 0.1.0 (25 March 2020) - -Initial release - -FEATURES: - - - Basic text synchronization with client (`didOpen`, `didClose`, `didChange`) - - Basic block body completion support for attributes and nested blocks - - Support for standard stdio transport - - Support for TCP transport (useful for debugging, or reducing the number of LS instances running) diff --git a/.changes/v0.33.2.md b/.changes/v0.33.2.md deleted file mode 100644 index 8ff1c7a86..000000000 --- a/.changes/v0.33.2.md +++ /dev/null @@ -1,24 +0,0 @@ -## 0.33.2 (06 June 2024) - -BUG FIXES: - -* Fix data race in schema merging logic ([hcl-lang#397](https://github.com/hashicorp/hcl-lang/pull/397)) - -INTERNAL: - -* Bump Go version to 1.22.4 ([#1727](https://github.com/hashicorp/terraform-ls/pull/1727)) -* Ensure license file gets packaged on build ([#1723](https://github.com/hashicorp/terraform-ls/pull/1723)) -* Remove non-empty directory during test cleanup ([#1696](https://github.com/hashicorp/terraform-ls/pull/1696)) -* Replace outdated remove-labels action with `gh` ([#1699](https://github.com/hashicorp/terraform-ls/pull/1699)) -* Reenable Dependabot for internal GitHub actions ([#1702](https://github.com/hashicorp/terraform-ls/pull/1702)) -* Fixed gosimple linter results for uri package ([#1707](https://github.com/hashicorp/terraform-ls/pull/1707)) -* Remove dead code, where the `LanguageId` was never set ([#1709](https://github.com/hashicorp/terraform-ls/pull/1709)) - -NOTE: - -Starting with this release, we are including a copy of our license file in all packaged versions of our releases, such as the release .zip files. If you are consuming these files directly and would prefer to extract the one terraform-ls file instead of extracting everything, you need to add an extra argument specifying the file to extract, like this: - -``` -unzip terraform-ls_0.33.2_linux_amd64.zip terraform-ls -``` - diff --git a/.changes/v0.33.3.md b/.changes/v0.33.3.md deleted file mode 100644 index f06b9c41e..000000000 --- a/.changes/v0.33.3.md +++ /dev/null @@ -1,11 +0,0 @@ -## 0.33.3 (27 June 2024) - -ENHANCEMENTS: - -* Add support for the new `templatestring` functions in Terraform 1.9 ([terraform-schema#357](https://github.com/hashicorp/terraform-schema/issues/357)) -* Introduce provisioners to `removed` blocks in Terraform 1.9 ([terraform-schema#358](https://github.com/hashicorp/terraform-schema/issues/358)) - -INTERNAL: - -* Document schema bundling in CONTRIBUTING.md ([#1736](https://github.com/hashicorp/terraform-ls/issues/1736)) - diff --git a/.changes/v0.34.0-alpha20240611.md b/.changes/v0.34.0-alpha20240611.md deleted file mode 100644 index a94ffcd85..000000000 --- a/.changes/v0.34.0-alpha20240611.md +++ /dev/null @@ -1,15 +0,0 @@ -## 0.34.0-alpha20240611 (11 June 2024) - -ENHANCEMENTS: - -* Add documentation for using vim with YouCompleteMe ([#1718](https://github.com/hashicorp/terraform-ls/issues/1718)) -* Re-architect the language server for improved performance and resource utilization ([#1667](https://github.com/hashicorp/terraform-ls/issues/1667)) - -This marks the completion of a major refactoring effort. The language server will now start up much faster and use less resources, especially on larger workspaces. We achieve this by doing less work during the initial walk of a workspace. Instead, we only parse modules with open files. Whenever a file of a module is opened, we schedule all the jobs needed to understand the contents of that directory (and the referenced modules). - -We have tested this with workspaces and configurations of different sizes, but still expect some bugs. Please give this preview a try and let us know how it works for you. - -INTERNAL: - -* Split internal modules state into separate features ([#1667](https://github.com/hashicorp/terraform-ls/issues/1667)) - diff --git a/.changes/v0.34.0-beta1.md b/.changes/v0.34.0-beta1.md deleted file mode 100644 index 7bdd2dec4..000000000 --- a/.changes/v0.34.0-beta1.md +++ /dev/null @@ -1,6 +0,0 @@ -## 0.34.0-beta1 (08 July 2024) - -ENHANCEMENTS: - -* Add initial support for Terraform Stacks files and Deployment files. This provides block and attribute completion, hover, and diagnostics along with syntax validation for Terraform Stacks and Deployment files ([#1745](https://github.com/hashicorp/terraform-ls/issues/1745)) - diff --git a/.changes/v0.34.0.md b/.changes/v0.34.0.md deleted file mode 100644 index 1217e1a15..000000000 --- a/.changes/v0.34.0.md +++ /dev/null @@ -1,16 +0,0 @@ -## 0.34.0 (15 July 2024) - -ENHANCEMENTS: - -* Add initial support for Terraform Stacks files and Deployment files. This provides block and attribute completion, hover, and diagnostics along with syntax validation for Terraform Stacks and Deployment files ([#1745](https://github.com/hashicorp/terraform-ls/issues/1745)) -* Add documentation for using vim with YouCompleteMe ([#1718](https://github.com/hashicorp/terraform-ls/issues/1718)) -* Enable completion for all locally installed remote modules ([#1760](https://github.com/hashicorp/terraform-ls/issues/1760)) -* Re-architect the language server for improved performance and resource utilization ([#1667](https://github.com/hashicorp/terraform-ls/issues/1667)) - -This marks the completion of a major refactoring effort. The language server will now start up much faster and use less resources, especially on larger workspaces. We achieve this by doing less work during the initial walk of a workspace. Instead, we only parse modules with open files. Whenever a file of a module is opened, we schedule all the jobs needed to understand the contents of that directory (and the referenced modules). - -INTERNAL: - -* Introduce a workflow that checks for changelog entries ([#1759](https://github.com/hashicorp/terraform-ls/issues/1759)) -* Split internal modules state into separate features ([#1667](https://github.com/hashicorp/terraform-ls/issues/1667)) - diff --git a/go.mod b/go.mod index 90aae5763..900068cd2 100644 --- a/go.mod +++ b/go.mod @@ -6,24 +6,24 @@ require ( github.com/algolia/algoliasearch-client-go/v3 v3.31.2 github.com/apparentlymart/go-textseg v1.0.0 github.com/creachadair/jrpc2 v1.2.0 + github.com/gamunu/opentofu-schema v0.0.0-20240911150107-f90e41b5579d github.com/google/go-cmp v0.6.0 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-memdb v1.3.4 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.7.0 - github.com/hashicorp/hc-install v0.7.0 + github.com/hashicorp/hc-install v0.8.0 github.com/hashicorp/hcl-lang v0.0.0-20240605150436-0e930f47b31b - github.com/hashicorp/hcl/v2 v2.21.0 + github.com/hashicorp/hcl/v2 v2.22.0 github.com/hashicorp/terraform-exec v0.21.0 github.com/hashicorp/terraform-json v0.22.1 - github.com/hashicorp/terraform-registry-address v0.2.3 - github.com/hashicorp/terraform-schema v0.0.0-20240715103008-d7b11d826dc8 github.com/mcuadros/go-defaults v1.2.0 github.com/mh-cbon/go-fmt-fail v0.0.0-20160815164508-67765b3fbcb5 github.com/mitchellh/cli v1.1.5 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/mapstructure v1.5.0 + github.com/opentofu/registry-address v0.0.0-20230922120653-901b9ae4061a github.com/otiai10/copy v1.14.0 github.com/pmezard/go-difflib v1.0.0 github.com/stretchr/testify v1.9.0 @@ -40,6 +40,7 @@ require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.7 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect ) @@ -48,7 +49,7 @@ require ( github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect - github.com/agext/levenshtein v1.2.2 // indirect + github.com/agext/levenshtein v1.2.3 // indirect github.com/antonmedv/expr v1.10.5 // indirect github.com/armon/go-radix v1.0.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect @@ -60,8 +61,8 @@ require ( github.com/djherbis/nio/v3 v3.0.1 // indirect github.com/fatih/color v1.16.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -84,7 +85,7 @@ require ( github.com/posener/complete v1.2.3 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/rs/zerolog v1.29.0 // indirect - github.com/shopspring/decimal v1.2.0 // indirect + github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.1 // indirect diff --git a/go.sum b/go.sum index 7826554b0..8049b3b1b 100644 --- a/go.sum +++ b/go.sum @@ -53,8 +53,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg= github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= -github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= -github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= +github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/algolia/algoliasearch-client-go/v3 v3.31.2 h1:T/k7b4C7OecOS2Q8//puhWe48P0g0bvtULJkCaZstL4= github.com/algolia/algoliasearch-client-go/v3 v3.31.2/go.mod h1:i7tLoP7TYDmHX3Q7vkIOL4syVse/k5VJ+k0i8WqFiJk= github.com/antonmedv/expr v1.10.5 h1:uzMxTbpHpOqV20RrNvBKHGojNwdRpcrgoFtgF4J8xtg= @@ -116,6 +116,8 @@ github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0X github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gamunu/opentofu-schema v0.0.0-20240911150107-f90e41b5579d h1:7xz282y9B9pbn/+AsgBF6MgJIc3QmKiSqgUDfaAPz4g= +github.com/gamunu/opentofu-schema v0.0.0-20240911150107-f90e41b5579d/go.mod h1:ZJnVmwCl4GTiy0J8XPKiYjlMpkJs7Z6bSz8+CvSq/ZY= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= @@ -189,15 +191,18 @@ github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -206,6 +211,8 @@ github.com/hashicorp/go-memdb v1.3.4/go.mod h1:uBTr1oQbtuMgd1SSGoR8YV27eT3sBHbYi github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -215,22 +222,18 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC1659aBk= -github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA= +github.com/hashicorp/hc-install v0.8.0 h1:LdpZeXkZYMQhoKPCecJHlKvUkQFixN/nvyR1CdfOLjI= +github.com/hashicorp/hc-install v0.8.0/go.mod h1:+MwJYjDfCruSD/udvBmRB22Nlkwwkwf5sAB6uTIhSaU= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl-lang v0.0.0-20240605150436-0e930f47b31b h1:DRIJYSwLKoAfdndwIH1NbjLC3wm/RuyT7eEtm8aKw1U= github.com/hashicorp/hcl-lang v0.0.0-20240605150436-0e930f47b31b/go.mod h1:/g6sedjVJX99knsqTKU9wSWBVtsyDKWJkseNV9Zx1aU= -github.com/hashicorp/hcl/v2 v2.21.0 h1:lve4q/o/2rqwYOgUg3y3V2YPyD1/zkCLGjIV74Jit14= -github.com/hashicorp/hcl/v2 v2.21.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= +github.com/hashicorp/hcl/v2 v2.22.0 h1:hkZ3nCtqeJsDhPRFz5EA9iwcG1hNWGePOTw6oyul12M= +github.com/hashicorp/hcl/v2 v2.22.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ= github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec= github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= -github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= -github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= -github.com/hashicorp/terraform-schema v0.0.0-20240715103008-d7b11d826dc8 h1:5y1/KiaPi/Ib/ZAkaKS30EjARaKiK2isnTrpI5pe9lI= -github.com/hashicorp/terraform-schema v0.0.0-20240715103008-d7b11d826dc8/go.mod h1:ar787Bv/qD6tlnjtzH8fQ1Yi6c/B5LsnpFlO8c92Atg= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hexops/autogold v1.3.1 h1:YgxF9OHWbEIUjhDbpnLhgVsjUDsiHDTyDfy2lrfdlzo= @@ -313,6 +316,8 @@ github.com/nightlyone/lockfile v1.0.0 h1:RHep2cFKK4PonZJDdEl4GmkabuhbsRMgk/k3uAm github.com/nightlyone/lockfile v1.0.0/go.mod h1:rywoIealpdNse2r832aiD9jRk8ErCatROs6LzC841CI= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/opentofu/registry-address v0.0.0-20230922120653-901b9ae4061a h1:NyM/PPbc+kxxv2d4OKfE32C5fLtVTLceyg4YKKCYO9Y= +github.com/opentofu/registry-address v0.0.0-20230922120653-901b9ae4061a/go.mod h1:HzQhpVo/NJnGmN+7FPECCVCA5ijU7AUcvf39enBKYOc= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= @@ -341,8 +346,9 @@ github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6us github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= -github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= diff --git a/internal/features/modules/decoder/decoder_test.go b/internal/features/modules/decoder/decoder_test.go index cec32ff65..46733cea3 100644 --- a/internal/features/modules/decoder/decoder_test.go +++ b/internal/features/modules/decoder/decoder_test.go @@ -16,6 +16,7 @@ import ( "testing" "testing/fstest" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/decoder" "github.com/hashicorp/hcl-lang/lang" @@ -24,7 +25,6 @@ import ( "github.com/hashicorp/terraform-ls/internal/features/modules/jobs" "github.com/hashicorp/terraform-ls/internal/features/modules/state" globalState "github.com/hashicorp/terraform-ls/internal/state" - tfmod "github.com/hashicorp/terraform-schema/module" ) type RootReaderMock struct{} diff --git a/internal/features/modules/decoder/functions.go b/internal/features/modules/decoder/functions.go index 255618976..c35d5cd8a 100644 --- a/internal/features/modules/decoder/functions.go +++ b/internal/features/modules/decoder/functions.go @@ -4,11 +4,11 @@ package decoder import ( + tfmodule "github.com/gamunu/opentofu-schema/module" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/schema" "github.com/hashicorp/terraform-ls/internal/features/modules/state" - tfmodule "github.com/hashicorp/terraform-schema/module" - tfschema "github.com/hashicorp/terraform-schema/schema" ) func functionsForModule(mod *state.ModuleRecord, stateReader CombinedReader) (map[string]schema.FunctionSignature, error) { diff --git a/internal/features/modules/decoder/module_schema.go b/internal/features/modules/decoder/module_schema.go index a96e55faa..320a8190b 100644 --- a/internal/features/modules/decoder/module_schema.go +++ b/internal/features/modules/decoder/module_schema.go @@ -4,11 +4,11 @@ package decoder import ( + tfmodule "github.com/gamunu/opentofu-schema/module" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/schema" "github.com/hashicorp/terraform-ls/internal/features/modules/state" - tfmodule "github.com/hashicorp/terraform-schema/module" - tfschema "github.com/hashicorp/terraform-schema/schema" ) func schemaForModule(mod *state.ModuleRecord, stateReader CombinedReader) (*schema.BodySchema, error) { diff --git a/internal/features/modules/decoder/path_reader.go b/internal/features/modules/decoder/path_reader.go index c2bc56f54..00a89fb1b 100644 --- a/internal/features/modules/decoder/path_reader.go +++ b/internal/features/modules/decoder/path_reader.go @@ -6,15 +6,15 @@ package decoder import ( "context" + tfmod "github.com/gamunu/opentofu-schema/module" + "github.com/gamunu/opentofu-schema/registry" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/decoder" "github.com/hashicorp/hcl-lang/lang" "github.com/hashicorp/terraform-ls/internal/features/modules/state" ilsp "github.com/hashicorp/terraform-ls/internal/lsp" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" - "github.com/hashicorp/terraform-schema/registry" - tfschema "github.com/hashicorp/terraform-schema/schema" + tfaddr "github.com/opentofu/registry-address" ) type StateReader interface { diff --git a/internal/features/modules/decoder/validations/unreferenced_origin.go b/internal/features/modules/decoder/validations/unreferenced_origin.go index 9d38fc115..4a0768918 100644 --- a/internal/features/modules/decoder/validations/unreferenced_origin.go +++ b/internal/features/modules/decoder/validations/unreferenced_origin.go @@ -25,7 +25,7 @@ func UnreferencedOrigins(ctx context.Context, pathCtx *decoder.PathContext) lang // DirectOrigin is represented as module's source // and we already validate existence of the local module // and avoiding linking to a non-existent module in terraform-schema - // https://github.com/hashicorp/terraform-schema/blob/b39f3de0/schema/module_schema.go#L212-L232 + // https://github.com/gamunu/opentofu-schema/blob/b39f3de0/schema/module_schema.go#L212-L232 // // PathOrigin is represented as module inputs // and we can validate module inputs more meaningfully diff --git a/internal/features/modules/events.go b/internal/features/modules/events.go index d59e1643c..d7d1f3c9b 100644 --- a/internal/features/modules/events.go +++ b/internal/features/modules/events.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-multierror" lsctx "github.com/hashicorp/terraform-ls/internal/context" "github.com/hashicorp/terraform-ls/internal/document" @@ -20,8 +21,7 @@ import ( globalState "github.com/hashicorp/terraform-ls/internal/state" globalAst "github.com/hashicorp/terraform-ls/internal/terraform/ast" op "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" ) func (f *ModulesFeature) discover(path string, files []string) error { diff --git a/internal/features/modules/hooks/module_version.go b/internal/features/modules/hooks/module_version.go index bf769a256..98a48179b 100644 --- a/internal/features/modules/hooks/module_version.go +++ b/internal/features/modules/hooks/module_version.go @@ -8,10 +8,10 @@ import ( "errors" "fmt" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/hcl-lang/decoder" "github.com/hashicorp/hcl/v2" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" "github.com/zclconf/go-cty/cty" ) diff --git a/internal/features/modules/hooks/module_version_test.go b/internal/features/modules/hooks/module_version_test.go index 22ff04838..f2265430e 100644 --- a/internal/features/modules/hooks/module_version_test.go +++ b/internal/features/modules/hooks/module_version_test.go @@ -10,6 +10,7 @@ import ( "net/http/httptest" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/google/go-cmp/cmp" "github.com/hashicorp/hcl-lang/decoder" "github.com/hashicorp/hcl-lang/lang" @@ -17,8 +18,7 @@ import ( "github.com/hashicorp/terraform-ls/internal/features/modules/state" "github.com/hashicorp/terraform-ls/internal/registry" globalState "github.com/hashicorp/terraform-ls/internal/state" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" "github.com/zclconf/go-cty/cty" ) diff --git a/internal/features/modules/jobs/metadata.go b/internal/features/modules/jobs/metadata.go index 7d9f3b114..6f0b96ac8 100644 --- a/internal/features/modules/jobs/metadata.go +++ b/internal/features/modules/jobs/metadata.go @@ -6,14 +6,14 @@ package jobs import ( "context" + "github.com/gamunu/opentofu-schema/earlydecoder" + tfmodule "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-ls/internal/document" "github.com/hashicorp/terraform-ls/internal/features/modules/state" "github.com/hashicorp/terraform-ls/internal/job" op "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" - "github.com/hashicorp/terraform-schema/earlydecoder" - tfmodule "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" ) // LoadModuleMetadata loads data about the module in a version-independent diff --git a/internal/features/modules/jobs/schema.go b/internal/features/modules/jobs/schema.go index 8e622f906..09149593c 100644 --- a/internal/features/modules/jobs/schema.go +++ b/internal/features/modules/jobs/schema.go @@ -13,6 +13,8 @@ import ( "log" "time" + tfregistry "github.com/gamunu/opentofu-schema/registry" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/lang" @@ -24,9 +26,7 @@ import ( "github.com/hashicorp/terraform-ls/internal/schemas" globalState "github.com/hashicorp/terraform-ls/internal/state" op "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfregistry "github.com/hashicorp/terraform-schema/registry" - tfschema "github.com/hashicorp/terraform-schema/schema" + tfaddr "github.com/opentofu/registry-address" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" "go.opentelemetry.io/otel" diff --git a/internal/features/modules/jobs/schema_mock_responses.go b/internal/features/modules/jobs/schema_mock_responses.go index 743cabe89..a96249199 100644 --- a/internal/features/modules/jobs/schema_mock_responses.go +++ b/internal/features/modules/jobs/schema_mock_responses.go @@ -4,9 +4,9 @@ package jobs import ( + tfregistry "github.com/gamunu/opentofu-schema/registry" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/lang" - tfregistry "github.com/hashicorp/terraform-schema/registry" "github.com/zclconf/go-cty/cty" ) diff --git a/internal/features/modules/jobs/schema_test.go b/internal/features/modules/jobs/schema_test.go index 7a3add019..83bf4075a 100644 --- a/internal/features/modules/jobs/schema_test.go +++ b/internal/features/modules/jobs/schema_test.go @@ -19,6 +19,7 @@ import ( "testing/fstest" "time" + tfregistry "github.com/gamunu/opentofu-schema/registry" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/lang" @@ -29,8 +30,7 @@ import ( "github.com/hashicorp/terraform-ls/internal/job" "github.com/hashicorp/terraform-ls/internal/registry" globalState "github.com/hashicorp/terraform-ls/internal/state" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfregistry "github.com/hashicorp/terraform-schema/registry" + tfaddr "github.com/opentofu/registry-address" "github.com/zclconf/go-cty-debug/ctydebug" "github.com/zclconf/go-cty/cty" ) diff --git a/internal/features/modules/jobs/validation_test.go b/internal/features/modules/jobs/validation_test.go index 8c937a322..d7468d413 100644 --- a/internal/features/modules/jobs/validation_test.go +++ b/internal/features/modules/jobs/validation_test.go @@ -8,6 +8,7 @@ import ( "path/filepath" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-version" lsctx "github.com/hashicorp/terraform-ls/internal/context" "github.com/hashicorp/terraform-ls/internal/features/modules/state" @@ -15,7 +16,6 @@ import ( ilsp "github.com/hashicorp/terraform-ls/internal/lsp" globalState "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/ast" - tfmod "github.com/hashicorp/terraform-schema/module" ) type RootReaderMock struct{} diff --git a/internal/features/modules/modules_feature.go b/internal/features/modules/modules_feature.go index 16aec4803..b63c10098 100644 --- a/internal/features/modules/modules_feature.go +++ b/internal/features/modules/modules_feature.go @@ -9,6 +9,8 @@ import ( "io" "log" + "github.com/gamunu/opentofu-schema/backend" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/decoder" "github.com/hashicorp/hcl-lang/lang" @@ -21,8 +23,6 @@ import ( "github.com/hashicorp/terraform-ls/internal/langserver/diagnostics" "github.com/hashicorp/terraform-ls/internal/registry" globalState "github.com/hashicorp/terraform-ls/internal/state" - "github.com/hashicorp/terraform-schema/backend" - tfmod "github.com/hashicorp/terraform-schema/module" ) // ModulesFeature groups everything related to modules. Its internal diff --git a/internal/features/modules/state/module_metadata.go b/internal/features/modules/state/module_metadata.go index b323efad3..47902ae2d 100644 --- a/internal/features/modules/state/module_metadata.go +++ b/internal/features/modules/state/module_metadata.go @@ -4,10 +4,10 @@ package state import ( + "github.com/gamunu/opentofu-schema/backend" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" - "github.com/hashicorp/terraform-schema/backend" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" ) // ModuleMetadata contains the result of the early decoding of a module, diff --git a/internal/features/modules/state/module_store.go b/internal/features/modules/state/module_store.go index 976495b96..080513c14 100644 --- a/internal/features/modules/state/module_store.go +++ b/internal/features/modules/state/module_store.go @@ -8,6 +8,9 @@ import ( "log" "path/filepath" + tfmod "github.com/gamunu/opentofu-schema/module" + "github.com/gamunu/opentofu-schema/registry" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/go-memdb" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/reference" @@ -16,10 +19,7 @@ import ( globalState "github.com/hashicorp/terraform-ls/internal/state" globalAst "github.com/hashicorp/terraform-ls/internal/terraform/ast" op "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" - "github.com/hashicorp/terraform-schema/registry" - tfschema "github.com/hashicorp/terraform-schema/schema" + tfaddr "github.com/opentofu/registry-address" ) type ModuleStore struct { diff --git a/internal/features/modules/state/module_test.go b/internal/features/modules/state/module_test.go index 23c51720d..c7707c0f3 100644 --- a/internal/features/modules/state/module_test.go +++ b/internal/features/modules/state/module_test.go @@ -8,6 +8,7 @@ import ( "path/filepath" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl/v2" @@ -19,8 +20,7 @@ import ( globalAst "github.com/hashicorp/terraform-ls/internal/terraform/ast" "github.com/hashicorp/terraform-ls/internal/terraform/datadir" "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" "github.com/zclconf/go-cty-debug/ctydebug" ) diff --git a/internal/features/rootmodules/jobs/lockfile_test.go b/internal/features/rootmodules/jobs/lockfile_test.go index ce00884ce..87e3229a8 100644 --- a/internal/features/rootmodules/jobs/lockfile_test.go +++ b/internal/features/rootmodules/jobs/lockfile_test.go @@ -19,7 +19,7 @@ import ( globalState "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/exec" "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" "github.com/stretchr/testify/mock" "github.com/zclconf/go-cty/cty" ) diff --git a/internal/features/rootmodules/jobs/schema.go b/internal/features/rootmodules/jobs/schema.go index 6843370b8..aa4660a7d 100644 --- a/internal/features/rootmodules/jobs/schema.go +++ b/internal/features/rootmodules/jobs/schema.go @@ -6,14 +6,14 @@ package jobs import ( "context" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/terraform-ls/internal/document" "github.com/hashicorp/terraform-ls/internal/features/rootmodules/state" "github.com/hashicorp/terraform-ls/internal/job" globalState "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/module" op "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfschema "github.com/hashicorp/terraform-schema/schema" + tfaddr "github.com/opentofu/registry-address" ) // ObtainSchema obtains provider schemas via Terraform CLI. diff --git a/internal/features/rootmodules/jobs/schema_test.go b/internal/features/rootmodules/jobs/schema_test.go index ff69d36f8..2f6f5aa45 100644 --- a/internal/features/rootmodules/jobs/schema_test.go +++ b/internal/features/rootmodules/jobs/schema_test.go @@ -8,6 +8,7 @@ import ( "path/filepath" "testing" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/lang" @@ -17,8 +18,7 @@ import ( "github.com/hashicorp/terraform-ls/internal/features/rootmodules/state" globalState "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/datadir" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfschema "github.com/hashicorp/terraform-schema/schema" + tfaddr "github.com/opentofu/registry-address" "github.com/zclconf/go-cty-debug/ctydebug" ) diff --git a/internal/features/rootmodules/jobs/version.go b/internal/features/rootmodules/jobs/version.go index 700168a17..a5227ac3c 100644 --- a/internal/features/rootmodules/jobs/version.go +++ b/internal/features/rootmodules/jobs/version.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-ls/internal/job" "github.com/hashicorp/terraform-ls/internal/terraform/module" op "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) // GetTerraformVersion obtains "installed" Terraform version diff --git a/internal/features/rootmodules/root_modules_feature.go b/internal/features/rootmodules/root_modules_feature.go index ae02ca452..b2b7db5cb 100644 --- a/internal/features/rootmodules/root_modules_feature.go +++ b/internal/features/rootmodules/root_modules_feature.go @@ -8,14 +8,14 @@ import ( "io" "log" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-ls/internal/eventbus" "github.com/hashicorp/terraform-ls/internal/features/rootmodules/jobs" "github.com/hashicorp/terraform-ls/internal/features/rootmodules/state" globalState "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/exec" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" ) // RootModulesFeature groups everything related to root modules. Its internal diff --git a/internal/features/rootmodules/state/installed_providers.go b/internal/features/rootmodules/state/installed_providers.go index 50ff7e80e..e6bdb6f4c 100644 --- a/internal/features/rootmodules/state/installed_providers.go +++ b/internal/features/rootmodules/state/installed_providers.go @@ -5,7 +5,7 @@ package state import ( "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) type InstalledProviders map[tfaddr.Provider]*version.Version diff --git a/internal/features/rootmodules/state/root_store.go b/internal/features/rootmodules/state/root_store.go index 7d87e09ae..5b0ab3d0b 100644 --- a/internal/features/rootmodules/state/root_store.go +++ b/internal/features/rootmodules/state/root_store.go @@ -7,14 +7,14 @@ import ( "log" "path/filepath" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-memdb" "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-ls/internal/document" globalState "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/datadir" op "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" ) type RootStore struct { diff --git a/internal/features/rootmodules/state/root_test.go b/internal/features/rootmodules/state/root_test.go index 77f38fd15..443a8c5c4 100644 --- a/internal/features/rootmodules/state/root_test.go +++ b/internal/features/rootmodules/state/root_test.go @@ -8,6 +8,7 @@ import ( "path/filepath" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl/v2" @@ -15,7 +16,6 @@ import ( globalState "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/datadir" "github.com/hashicorp/terraform-ls/internal/terraform/module/operation" - tfmod "github.com/hashicorp/terraform-schema/module" "github.com/zclconf/go-cty-debug/ctydebug" ) diff --git a/internal/features/stacks/decoder/path_reader.go b/internal/features/stacks/decoder/path_reader.go index 07cdfcd22..65a4ef059 100644 --- a/internal/features/stacks/decoder/path_reader.go +++ b/internal/features/stacks/decoder/path_reader.go @@ -7,6 +7,7 @@ import ( "context" "fmt" + stackschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/hcl-lang/decoder" "github.com/hashicorp/hcl-lang/lang" "github.com/hashicorp/hcl-lang/reference" @@ -14,7 +15,6 @@ import ( "github.com/hashicorp/terraform-ls/internal/features/stacks/ast" "github.com/hashicorp/terraform-ls/internal/features/stacks/state" ilsp "github.com/hashicorp/terraform-ls/internal/lsp" - stackschema "github.com/hashicorp/terraform-schema/schema" ) type PathReader struct { diff --git a/internal/features/variables/decoder/path_reader.go b/internal/features/variables/decoder/path_reader.go index 602811def..ed2f8d233 100644 --- a/internal/features/variables/decoder/path_reader.go +++ b/internal/features/variables/decoder/path_reader.go @@ -6,12 +6,12 @@ package decoder import ( "context" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/hcl-lang/decoder" "github.com/hashicorp/hcl-lang/lang" "github.com/hashicorp/terraform-ls/internal/document" "github.com/hashicorp/terraform-ls/internal/features/variables/state" ilsp "github.com/hashicorp/terraform-ls/internal/lsp" - tfmod "github.com/hashicorp/terraform-schema/module" ) type StateReader interface { diff --git a/internal/features/variables/decoder/variable_context.go b/internal/features/variables/decoder/variable_context.go index f101e867e..5c4b0c92f 100644 --- a/internal/features/variables/decoder/variable_context.go +++ b/internal/features/variables/decoder/variable_context.go @@ -4,13 +4,13 @@ package decoder import ( + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/hcl-lang/decoder" "github.com/hashicorp/hcl-lang/reference" "github.com/hashicorp/hcl-lang/schema" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/terraform-ls/internal/features/variables/ast" "github.com/hashicorp/terraform-ls/internal/features/variables/state" - tfschema "github.com/hashicorp/terraform-schema/schema" ) func variablePathContext(mod *state.VariableRecord, moduleReader ModuleReader, useAnySchema bool) (*decoder.PathContext, error) { diff --git a/internal/features/variables/jobs/validation_test.go b/internal/features/variables/jobs/validation_test.go index cbf179896..8ae93d768 100644 --- a/internal/features/variables/jobs/validation_test.go +++ b/internal/features/variables/jobs/validation_test.go @@ -8,6 +8,7 @@ import ( "path/filepath" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" lsctx "github.com/hashicorp/terraform-ls/internal/context" "github.com/hashicorp/terraform-ls/internal/document" "github.com/hashicorp/terraform-ls/internal/features/variables/state" @@ -16,7 +17,6 @@ import ( globalState "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/ast" "github.com/hashicorp/terraform-ls/internal/uri" - tfmod "github.com/hashicorp/terraform-schema/module" ) type ModuleReaderMock struct{} diff --git a/internal/langserver/handlers/command/module_calls.go b/internal/langserver/handlers/command/module_calls.go index d0d218368..8d568624e 100644 --- a/internal/langserver/handlers/command/module_calls.go +++ b/internal/langserver/handlers/command/module_calls.go @@ -10,10 +10,10 @@ import ( "strings" "github.com/creachadair/jrpc2" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/terraform-ls/internal/langserver/cmd" "github.com/hashicorp/terraform-ls/internal/uri" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" ) const moduleCallsVersion = 0 diff --git a/internal/langserver/handlers/command/module_calls_test.go b/internal/langserver/handlers/command/module_calls_test.go index eefff03c2..8087726dd 100644 --- a/internal/langserver/handlers/command/module_calls_test.go +++ b/internal/langserver/handlers/command/module_calls_test.go @@ -7,10 +7,10 @@ import ( "context" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" ) func Test_parseModuleRecords(t *testing.T) { diff --git a/internal/langserver/handlers/command/module_providers.go b/internal/langserver/handlers/command/module_providers.go index 183b555b1..ea97bb325 100644 --- a/internal/langserver/handlers/command/module_providers.go +++ b/internal/langserver/handlers/command/module_providers.go @@ -10,7 +10,7 @@ import ( "github.com/creachadair/jrpc2" "github.com/hashicorp/terraform-ls/internal/langserver/cmd" "github.com/hashicorp/terraform-ls/internal/uri" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) const moduleProvidersVersion = 0 diff --git a/internal/langserver/handlers/did_change_watched_files_test.go b/internal/langserver/handlers/did_change_watched_files_test.go index aa208920c..4a6986d2d 100644 --- a/internal/langserver/handlers/did_change_watched_files_test.go +++ b/internal/langserver/handlers/did_change_watched_files_test.go @@ -24,7 +24,7 @@ import ( "github.com/hashicorp/terraform-ls/internal/state" "github.com/hashicorp/terraform-ls/internal/terraform/exec" "github.com/hashicorp/terraform-ls/internal/walker" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" "github.com/otiai10/copy" "github.com/stretchr/testify/mock" ) diff --git a/internal/langserver/handlers/execute_command_module_providers_test.go b/internal/langserver/handlers/execute_command_module_providers_test.go index 3633a1f7f..62f806a74 100644 --- a/internal/langserver/handlers/execute_command_module_providers_test.go +++ b/internal/langserver/handlers/execute_command_module_providers_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/creachadair/jrpc2" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-ls/internal/document" "github.com/hashicorp/terraform-ls/internal/eventbus" @@ -18,8 +19,7 @@ import ( "github.com/hashicorp/terraform-ls/internal/terraform/exec" "github.com/hashicorp/terraform-ls/internal/uri" "github.com/hashicorp/terraform-ls/internal/walker" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" "github.com/stretchr/testify/mock" ) diff --git a/internal/langserver/handlers/execute_command_terraform_version_test.go b/internal/langserver/handlers/execute_command_terraform_version_test.go index 3e280fdca..e907f8440 100644 --- a/internal/langserver/handlers/execute_command_terraform_version_test.go +++ b/internal/langserver/handlers/execute_command_terraform_version_test.go @@ -7,6 +7,7 @@ import ( "fmt" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-ls/internal/document" "github.com/hashicorp/terraform-ls/internal/eventbus" @@ -17,8 +18,7 @@ import ( "github.com/hashicorp/terraform-ls/internal/terraform/exec" "github.com/hashicorp/terraform-ls/internal/uri" "github.com/hashicorp/terraform-ls/internal/walker" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfmod "github.com/hashicorp/terraform-schema/module" + tfaddr "github.com/opentofu/registry-address" "github.com/stretchr/testify/mock" ) diff --git a/internal/lsp/semantic_tokens.go b/internal/lsp/semantic_tokens.go index 70520b3f8..d8c8650a0 100644 --- a/internal/lsp/semantic_tokens.go +++ b/internal/lsp/semantic_tokens.go @@ -4,10 +4,10 @@ package lsp import ( + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/hcl-lang/lang" "github.com/hashicorp/terraform-ls/internal/lsp/semtok" lsp "github.com/hashicorp/terraform-ls/internal/protocol" - tfschema "github.com/hashicorp/terraform-schema/schema" ) // Registering types which are actually in use diff --git a/internal/registry/module.go b/internal/registry/module.go index b3932733d..db6d792d9 100644 --- a/internal/registry/module.go +++ b/internal/registry/module.go @@ -14,7 +14,7 @@ import ( "time" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" diff --git a/internal/registry/module_test.go b/internal/registry/module_test.go index df5e3de56..690c1189d 100644 --- a/internal/registry/module_test.go +++ b/internal/registry/module_test.go @@ -14,7 +14,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) func TestGetModuleData(t *testing.T) { diff --git a/internal/schemas/gen/gen.go b/internal/schemas/gen/gen.go index 12ca07301..6c11c2f2c 100644 --- a/internal/schemas/gen/gen.go +++ b/internal/schemas/gen/gen.go @@ -32,7 +32,7 @@ import ( tfjson "github.com/hashicorp/terraform-json" lsctx "github.com/hashicorp/terraform-ls/internal/context" "github.com/hashicorp/terraform-ls/internal/registry" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) var terraformVersion = version.MustConstraints(version.NewConstraint("~> 1.0")) diff --git a/internal/schemas/schemas.go b/internal/schemas/schemas.go index 798dee9f3..e1342294d 100644 --- a/internal/schemas/schemas.go +++ b/internal/schemas/schemas.go @@ -13,7 +13,7 @@ import ( "path" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) //go:embed data diff --git a/internal/state/installed_providers.go b/internal/state/installed_providers.go index 50ff7e80e..e6bdb6f4c 100644 --- a/internal/state/installed_providers.go +++ b/internal/state/installed_providers.go @@ -5,7 +5,7 @@ package state import ( "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) type InstalledProviders map[tfaddr.Provider]*version.Version diff --git a/internal/state/provider_ids.go b/internal/state/provider_ids.go index add32e095..ebc3fb674 100644 --- a/internal/state/provider_ids.go +++ b/internal/state/provider_ids.go @@ -5,7 +5,7 @@ package state import ( "github.com/hashicorp/go-uuid" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) type ProviderIds struct { diff --git a/internal/state/provider_schema.go b/internal/state/provider_schema.go index 94bfc9af9..8bd91a37b 100644 --- a/internal/state/provider_schema.go +++ b/internal/state/provider_schema.go @@ -7,10 +7,10 @@ import ( "fmt" "sort" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/hashicorp/go-memdb" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfschema "github.com/hashicorp/terraform-schema/schema" + tfaddr "github.com/opentofu/registry-address" ) type ProviderSchema struct { diff --git a/internal/state/provider_schema_test.go b/internal/state/provider_schema_test.go index f132c994a..43dcdc419 100644 --- a/internal/state/provider_schema_test.go +++ b/internal/state/provider_schema_test.go @@ -7,10 +7,10 @@ import ( "errors" "testing" + tfschema "github.com/gamunu/opentofu-schema/schema" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" - tfschema "github.com/hashicorp/terraform-schema/schema" + tfaddr "github.com/opentofu/registry-address" ) func TestStateStore_AddPreloadedSchema_duplicate(t *testing.T) { diff --git a/internal/state/registry_modules.go b/internal/state/registry_modules.go index a9519f14b..2eaf753ac 100644 --- a/internal/state/registry_modules.go +++ b/internal/state/registry_modules.go @@ -6,9 +6,9 @@ package state import ( "fmt" + "github.com/gamunu/opentofu-schema/registry" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" - "github.com/hashicorp/terraform-schema/registry" + tfaddr "github.com/opentofu/registry-address" ) type RegistryModuleData struct { diff --git a/internal/state/registry_modules_test.go b/internal/state/registry_modules_test.go index 83a7fb1e9..8dbaf218d 100644 --- a/internal/state/registry_modules_test.go +++ b/internal/state/registry_modules_test.go @@ -6,11 +6,11 @@ package state import ( "testing" + "github.com/gamunu/opentofu-schema/registry" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/lang" - tfaddr "github.com/hashicorp/terraform-registry-address" - "github.com/hashicorp/terraform-schema/registry" + tfaddr "github.com/opentofu/registry-address" "github.com/zclconf/go-cty-debug/ctydebug" "github.com/zclconf/go-cty/cty" ) diff --git a/internal/terraform/datadir/module_manifest.go b/internal/terraform/datadir/module_manifest.go index fe1b33ea0..a966c015c 100644 --- a/internal/terraform/datadir/module_manifest.go +++ b/internal/terraform/datadir/module_manifest.go @@ -11,9 +11,9 @@ import ( "path/filepath" "strings" + tfmod "github.com/gamunu/opentofu-schema/module" version "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-ls/internal/pathcmp" - tfmod "github.com/hashicorp/terraform-schema/module" ) var manifestPathElements = []string{ diff --git a/internal/terraform/datadir/module_manifest_test.go b/internal/terraform/datadir/module_manifest_test.go index 15f87633f..a7ba307e2 100644 --- a/internal/terraform/datadir/module_manifest_test.go +++ b/internal/terraform/datadir/module_manifest_test.go @@ -8,9 +8,9 @@ import ( "path/filepath" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" - tfmod "github.com/hashicorp/terraform-schema/module" ) func TestParseModuleManifestFromFile(t *testing.T) { diff --git a/internal/terraform/datadir/module_manifest_unix_test.go b/internal/terraform/datadir/module_manifest_unix_test.go index 3381f53d6..e4cd3f0cd 100644 --- a/internal/terraform/datadir/module_manifest_unix_test.go +++ b/internal/terraform/datadir/module_manifest_unix_test.go @@ -10,9 +10,9 @@ import ( "encoding/json" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" - tfmod "github.com/hashicorp/terraform-schema/module" ) func TestRecord_UnmarshalJSON_basic(t *testing.T) { diff --git a/internal/terraform/datadir/module_manifest_windows_test.go b/internal/terraform/datadir/module_manifest_windows_test.go index 55487b0c8..003001aa5 100644 --- a/internal/terraform/datadir/module_manifest_windows_test.go +++ b/internal/terraform/datadir/module_manifest_windows_test.go @@ -7,9 +7,9 @@ import ( "encoding/json" "testing" + tfmod "github.com/gamunu/opentofu-schema/module" "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" - tfmod "github.com/hashicorp/terraform-schema/module" ) func TestRecord_UnmarshalJSON_basic(t *testing.T) { diff --git a/internal/terraform/datadir/plugin_lock_file.go b/internal/terraform/datadir/plugin_lock_file.go index 145f39b75..127eeabe0 100644 --- a/internal/terraform/datadir/plugin_lock_file.go +++ b/internal/terraform/datadir/plugin_lock_file.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-version" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hclsyntax" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" "github.com/zclconf/go-cty/cty" ) diff --git a/internal/terraform/datadir/plugin_lock_file_test.go b/internal/terraform/datadir/plugin_lock_file_test.go index 7d2493ffd..5c84502d2 100644 --- a/internal/terraform/datadir/plugin_lock_file_test.go +++ b/internal/terraform/datadir/plugin_lock_file_test.go @@ -12,7 +12,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/hashicorp/go-version" - tfaddr "github.com/hashicorp/terraform-registry-address" + tfaddr "github.com/opentofu/registry-address" ) func TestParsePluginVersions_basic012(t *testing.T) { diff --git a/main.go b/main.go index dc946af51..252fb2051 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,7 @@ import ( func main() { c := &cli.CLI{ - Name: "terraform-ls", + Name: "opentofu-ls", Version: VersionString(), Args: os.Args[1:], HelpWriter: os.Stdout, diff --git a/version.go b/version.go index 1e1ac4c72..dbabdfe29 100644 --- a/version.go +++ b/version.go @@ -4,7 +4,7 @@ package main var ( - version = "0.2.0-dev" + version = "0.3.0-dev" commit = "none" date = "unknown" ) From c8b8fa36619eab6ac246d0a1b5bdd5a1edbbeb8a Mon Sep 17 00:00:00 2001 From: Gamunu Balagalla Date: Wed, 11 Sep 2024 21:22:59 +0530 Subject: [PATCH 2/5] fix: update changelog configs Signed-off-by: Gamunu Balagalla --- .../ENHANCEMENTS-20240911-212122.yaml | 6 + .changie.yaml | 6 +- CHANGELOG.md | 1348 ----------------- 3 files changed, 9 insertions(+), 1351 deletions(-) create mode 100644 .changes/unreleased/ENHANCEMENTS-20240911-212122.yaml diff --git a/.changes/unreleased/ENHANCEMENTS-20240911-212122.yaml b/.changes/unreleased/ENHANCEMENTS-20240911-212122.yaml new file mode 100644 index 000000000..ef398eac0 --- /dev/null +++ b/.changes/unreleased/ENHANCEMENTS-20240911-212122.yaml @@ -0,0 +1,6 @@ +kind: ENHANCEMENTS +body: use opentofu schema and opentofu registry libraries +time: 2024-09-11T21:21:22.4141+05:30 +custom: + Issue: "17" + Repository: terraform-ls diff --git a/.changie.yaml b/.changie.yaml index 615035f73..cf6356ca4 100644 --- a/.changie.yaml +++ b/.changie.yaml @@ -7,14 +7,14 @@ changelogPath: CHANGELOG.md versionExt: md versionFormat: '## {{.VersionNoPrefix}} ({{.Time.Format "02 January 2006"}})' kindFormat: '{{.Kind}}:' -changeFormat: '* {{.Body}} ([{{- if not (eq .Custom.Repository "terraform-ls")}}{{.Custom.Repository}}{{- end}}#{{.Custom.Issue}}](https://github.com/hashicorp/{{.Custom.Repository}}/issues/{{.Custom.Issue}}))' +changeFormat: '* {{.Body}} ([{{- if not (eq .Custom.Repository "opentofu-ls")}}{{.Custom.Repository}}{{- end}}#{{.Custom.Issue}}](https://github.com/gamunu/{{.Custom.Repository}}/issues/{{.Custom.Issue}}))' custom: - key: Repository label: Repository type: enum enumOptions: - - terraform-ls - - terraform-schema + - opentofu-ls + - opentofu-schema - hcl-lang - key: Issue label: Issue/PR Number diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bf92aa55..e69de29bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1348 +0,0 @@ -## 0.34.0 (15 July 2024) - -ENHANCEMENTS: - -* Add initial support for Terraform Stacks files and Deployment files. This provides block and attribute completion, hover, and diagnostics along with syntax validation for Terraform Stacks and Deployment files ([#1745](https://github.com/hashicorp/terraform-ls/issues/1745)) -* Add documentation for using vim with YouCompleteMe ([#1718](https://github.com/hashicorp/terraform-ls/issues/1718)) -* Enable completion for all locally installed remote modules ([#1760](https://github.com/hashicorp/terraform-ls/issues/1760)) -* Re-architect the language server for improved performance and resource utilization ([#1667](https://github.com/hashicorp/terraform-ls/issues/1667)) - -This marks the completion of a major refactoring effort. The language server will now start up much faster and use less resources, especially on larger workspaces. We achieve this by doing less work during the initial walk of a workspace. Instead, we only parse modules with open files. Whenever a file of a module is opened, we schedule all the jobs needed to understand the contents of that directory (and the referenced modules). - -INTERNAL: - -* Introduce a workflow that checks for changelog entries ([#1759](https://github.com/hashicorp/terraform-ls/issues/1759)) -* Split internal modules state into separate features ([#1667](https://github.com/hashicorp/terraform-ls/issues/1667)) - -## 0.34.0-beta1 (08 July 2024) - -ENHANCEMENTS: - -* Add initial support for Terraform Stacks files and Deployment files. This provides block and attribute completion, hover, and diagnostics along with syntax validation for Terraform Stacks and Deployment files ([#1745](https://github.com/hashicorp/terraform-ls/issues/1745)) - -## 0.34.0-alpha20240611 (11 June 2024) - -ENHANCEMENTS: - -* Add documentation for using vim with YouCompleteMe ([#1718](https://github.com/hashicorp/terraform-ls/issues/1718)) -* Re-architect the language server for improved performance and resource utilization ([#1667](https://github.com/hashicorp/terraform-ls/issues/1667)) - -This marks the completion of a major refactoring effort. The language server will now start up much faster and use less resources, especially on larger workspaces. We achieve this by doing less work during the initial walk of a workspace. Instead, we only parse modules with open files. Whenever a file of a module is opened, we schedule all the jobs needed to understand the contents of that directory (and the referenced modules). - -We have tested this with workspaces and configurations of different sizes, but still expect some bugs. Please give this preview a try and let us know how it works for you. - -INTERNAL: - -* Split internal modules state into separate features ([#1667](https://github.com/hashicorp/terraform-ls/issues/1667)) - -## 0.33.3 (27 June 2024) - -ENHANCEMENTS: - -* Add support for the new `templatestring` functions in Terraform 1.9 ([terraform-schema#357](https://github.com/hashicorp/terraform-schema/issues/357)) -* Introduce provisioners to `removed` blocks in Terraform 1.9 ([terraform-schema#358](https://github.com/hashicorp/terraform-schema/issues/358)) - -INTERNAL: - -* Document schema bundling in CONTRIBUTING.md ([#1736](https://github.com/hashicorp/terraform-ls/issues/1736)) - -## 0.33.2 (06 June 2024) - -BUG FIXES: - -* Fix data race in schema merging logic ([hcl-lang#397](https://github.com/hashicorp/hcl-lang/pull/397)) - -INTERNAL: - -* Bump Go version to 1.22.4 ([#1727](https://github.com/hashicorp/terraform-ls/pull/1727)) -* Ensure license file gets packaged on build ([#1723](https://github.com/hashicorp/terraform-ls/pull/1723)) -* Remove non-empty directory during test cleanup ([#1696](https://github.com/hashicorp/terraform-ls/pull/1696)) -* Replace outdated remove-labels action with `gh` ([#1699](https://github.com/hashicorp/terraform-ls/pull/1699)) -* Reenable Dependabot for internal GitHub actions ([#1702](https://github.com/hashicorp/terraform-ls/pull/1702)) -* Fixed gosimple linter results for uri package ([#1707](https://github.com/hashicorp/terraform-ls/pull/1707)) -* Remove dead code, where the `LanguageId` was never set ([#1709](https://github.com/hashicorp/terraform-ls/pull/1709)) - -NOTE: - -Starting with this release, we are including a copy of our license file in all packaged versions of our releases, such as the release .zip files. If you are consuming these files directly and would prefer to extract the one terraform-ls file instead of extracting everything, you need to add an extra argument specifying the file to extract, like this: - -``` -unzip terraform-ls_0.33.2_linux_amd64.zip terraform-ls -``` - -## 0.33.1 (22 April 2024) - -ENHANCEMENTS: - -* Rename TFC to HCP Terraform in documentation ([#1687](https://github.com/hashicorp/terraform-ls/pull/1687)) -* Rename TFC to HCP Terraform in hover documentation ([terraform-schema#1687](https://github.com/hashicorp/terraform-schema/pull/343)) - -INTERNAL: - -* Remove token from delete-artifact action ([#1685](https://github.com/hashicorp/terraform-ls/pull/1685)) -* Revert "Use Terraform 1.8-rc1 for bundling schemas (#1669)" ([#1686](https://github.com/hashicorp/terraform-ls/pull/1686)) - -## 0.33.0 (10 April 2024) - -ENHANCEMENTS: - -* Support for provider-defined functions ([#1636](https://github.com/hashicorp/terraform-ls/pull/1636)) -* Remove `use_legacy_workflow` from S3 backend ([terraform-schema#338](https://github.com/hashicorp/terraform-schema/pull/338)) -* Add `issensitive` function ([terraform-schema#340](https://github.com/hashicorp/terraform-schema/pull/340)) -* Conclude `module_variable_optional_attrs` language experiment ([terraform-schema#337](https://github.com/hashicorp/terraform-schema/pull/337)) - -BUG FIXES: - -* Only merge provider-defined functions for Terraform >= 1.8 ([#1672](https://github.com/hashicorp/terraform-ls/pull/1672), [terraform-schema#336](https://github.com/hashicorp/terraform-schema/pull/336)) - -INTERNAL: - -* Use Terraform `1.8.0-rc1` for bundling schemas ([#1669](https://github.com/hashicorp/terraform-ls/pull/1669)) -* Update net package (updates some more alongside) ([#1677](https://github.com/hashicorp/terraform-ls/pull/1677)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.42.0 to 2.42.2 ([#1662](https://github.com/hashicorp/terraform-ls/pull/1662), [#1680](https://github.com/hashicorp/terraform-ls/pull/1680)) -* build(deps): Bump github.com/zclconf/go-cty from 1.14.3 to 1.14.4 ([#1666](https://github.com/hashicorp/terraform-ls/pull/1666)) -* build(deps): Bump workflows to latest trusted versions ([#1673](https://github.com/hashicorp/terraform-ls/pull/1673)) -* build(deps): Bump golang.org/x/tools from 0.19.0 to 0.20.0 ([#1679](https://github.com/hashicorp/terraform-ls/pull/1679)) -* build(deps): Bump github.com/creachadair/jrpc2 from 1.1.2 to 1.2.0 ([#1674](https://github.com/hashicorp/terraform-ls/pull/1674)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.6.3 to 0.6.4 ([#1675](https://github.com/hashicorp/terraform-ls/pull/1675)) -* build(deps): Bump go.opentelemetry.io/otel/trace from 1.24.0 to 1.25.0 ([#1678](https://github.com/hashicorp/terraform-ls/pull/1678)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.49.0 to 0.50.0 ([#1681](https://github.com/hashicorp/terraform-ls/pull/1681)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.49.0 to 0.50.0 ([#1682](https://github.com/hashicorp/terraform-ls/pull/1682)) - -## 0.33.0-beta2 (27 March 2024) - -ENHANCEMENTS: - -* Support for provider-defined functions ([#1636](https://github.com/hashicorp/terraform-ls/pull/1636)) - -INTERNAL: - -* Use Terraform `1.8.0-rc1` for bundling schemas ([#1669](https://github.com/hashicorp/terraform-ls/pull/1669)) - -## 0.32.8 (11 March 2024) - -NOTES / BREAKING CHANGES: - -* Remove `inspect-module` command ([#1642](https://github.com/hashicorp/terraform-ls/pull/1642)) - -BUG FIXES: - -* Fix `for` expression collection constraints ([hcl-lang#375](https://github.com/hashicorp/hcl-lang/pull/375)) - -INTERNAL: - -* Remove getting provider schema log line ([#1643](https://github.com/hashicorp/terraform-ls/pull/1643)) -* Ignore preloaded schemas in complex module test ([#1638](https://github.com/hashicorp/terraform-ls/pull/1638)) -* Remove outdated LSP comparison from README ([#1641](https://github.com/hashicorp/terraform-ls/pull/1641)) -* Link to `.github/CONTRIBUTING.md` in README ([#1635](https://github.com/hashicorp/terraform-ls/pull/1635)) -* Bump Go version ([#1649](https://github.com/hashicorp/terraform-ls/pull/1649)) -* Enable pre releases via CRT ([#1651](https://github.com/hashicorp/terraform-ls/pull/1651)) -* build(deps): Bump workflows to latest trusted versions ([#1605](https://github.com/hashicorp/terraform-ls/pull/1605), [#1639](https://github.com/hashicorp/terraform-ls/pull/1639), [#1656](https://github.com/hashicorp/terraform-ls/pull/1656), [#1659](https://github.com/hashicorp/terraform-ls/pull/1659)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.40.3 to 2.42.0 ([#1633](https://github.com/hashicorp/terraform-ls/pull/1633), [#1640](https://github.com/hashicorp/terraform-ls/pull/1640)) -* build(deps): Bump golang.org/x/tools from 0.17.0 to 0.19.0 ([#1634](https://github.com/hashicorp/terraform-ls/pull/1634), [#1658](https://github.com/hashicorp/terraform-ls/pull/1658)) -* build(deps): Bump go.opentelemetry.io/otel from 1.23.1 to 1.24.0 ([#1644](https://github.com/hashicorp/terraform-ls/pull/1644)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.48.0 to 0.49.0 ([#1647](https://github.com/hashicorp/terraform-ls/pull/1647)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.48.0 to 0.49.0 ([#1646](https://github.com/hashicorp/terraform-ls/pull/1646)) -* build(deps): Bump github.com/zclconf/go-cty from 1.14.2 to 1.14.3 ([#1654](https://github.com/hashicorp/terraform-ls/pull/1654)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.31.0 to 3.31.1 ([#1657](https://github.com/hashicorp/terraform-ls/pull/1657)) -* build(deps): Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 ([#1653](https://github.com/hashicorp/terraform-ls/pull/1653)) - -## 0.33.0-beta1 (29 February 2024) - -BUG FIXES: - -* Fix panics on `nil` expressions ([hcl-lang#376](https://github.com/hashicorp/hcl-lang/pull/376)) -* Fix panics on `nil` expressions in early decoder ([terraform-schema#324](https://github.com/hashicorp/terraform-schema/pull/324)) - -## 0.32.7 (13 February 2024) - -ENHANCEMENTS: - -* Support `for`-`in`-`if` expressions ([hcl-lang#368](https://github.com/hashicorp/hcl-lang/pull/368)) - -BUG FIXES: - -* Fix prefix completion in `TemplateWrapExpr` ([hcl-lang#371](https://github.com/hashicorp/hcl-lang/pull/371)) -* Fix LS panic on prefix completion with leading space ([hcl-lang#373](https://github.com/hashicorp/hcl-lang/pull/373)) -* Fix LS panic on missing symbols in client capabilities ([#1619](https://github.com/hashicorp/terraform-ls/pull/1619)) - -INTERNAL: - -* github: Remove benchmarks workflow ([#1599](https://github.com/hashicorp/terraform-ls/pull/1599)) -* chore: fix typo in comment ([#1612](https://github.com/hashicorp/terraform-ls/pull/1612)) -* build(deps): Bump github.com/zclconf/go-cty from 1.14.1 to 1.14.2 ([#1600](https://github.com/hashicorp/terraform-ls/pull/1600)) -* build(deps): Bump go.opentelemetry.io/otel from 1.22.0 to 1.23.1 ([#1617](https://github.com/hashicorp/terraform-ls/pull/1617), [#1621](https://github.com/hashicorp/terraform-ls/pull/1621)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.47.0 to 0.48.0 ([#1616](https://github.com/hashicorp/terraform-ls/pull/1616)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.47.0 to 0.48.0 ([#1618](https://github.com/hashicorp/terraform-ls/pull/1618)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.6.2 to 0.6.3 ([#1622](https://github.com/hashicorp/terraform-ls/pull/1622)) -* build(deps): Bump workflows to latest trusted versions ([#1624](https://github.com/hashicorp/terraform-ls/pull/1624)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.40.1 to 2.40.3 ([#1625](https://github.com/hashicorp/terraform-ls/pull/1625)) - -## 0.32.6 (23 January 2024) - -ENHANCEMENTS: - -* Enable interpolated map keys and object attribute names ([terraform-schema#316](https://github.com/hashicorp/terraform-schema/pull/316)) -* Add support for complex index expressions ([hcl-lang#365](https://github.com/hashicorp/hcl-lang/pull/365)) -* Add support for parenthesis on RHS ([hcl-lang#366](https://github.com/hashicorp/hcl-lang/pull/366)) -* Add support for parenthesis on LHS (map keys & attribute names) ([hcl-lang#367](https://github.com/hashicorp/hcl-lang/pull/367)) - -BUG FIXES: - -* Revert "Alert on `wsl.localhost` Path ([#1522](https://github.com/hashicorp/terraform-ls/pull/1522))" ([#1597](https://github.com/hashicorp/terraform-ls/pull/1597)) - -INTERNAL: - -* build(deps): Bump go.opentelemetry.io/otel from 1.21.0 to 1.22.0 ([#1589](https://github.com/hashicorp/terraform-ls/pull/1589)) -* build(deps): Bump go.opentelemetry.io/otel/trace from 1.21.0 to 1.22.0 ([#1588](https://github.com/hashicorp/terraform-ls/pull/1588)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.20.0 to 0.21.0 ([#1591](https://github.com/hashicorp/terraform-ls/pull/1591)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.46.1 to 0.47.0 ([#1592](https://github.com/hashicorp/terraform-ls/pull/1592)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.46.1 to 0.47.0 ([#1593](https://github.com/hashicorp/terraform-ls/pull/1593)) -* build(deps): Bump workflows to latest trusted versions ([#1594](https://github.com/hashicorp/terraform-ls/pull/1594)) - -## 0.32.5 (16 January 2024) - -ENHANCEMENTS: - -* Alert on `wsl.localhost` Path ([#1522](https://github.com/hashicorp/terraform-ls/pull/1522)) -* Enable `for_each` for `import` blocks (Terraform 1.7) ([terraform-schema#315](https://github.com/hashicorp/terraform-schema/pull/315)) -* Add `removed` block (Terraform 1.7) ([terraform-schema#313](https://github.com/hashicorp/terraform-schema/pull/313)) -* Deprecate `use_legacy_workflow` in S3 Backend (Terraform 1.7) ([terraform-schema#314](https://github.com/hashicorp/terraform-schema/pull/314)) - -INTERNAL: - -* docs: update syntax-highlighting.md ([#1528](https://github.com/hashicorp/terraform-ls/pull/1528)) -* go: bump version to 1.21.5 ([#1521](https://github.com/hashicorp/terraform-ls/pull/1521)) -* ci: Automate releasing via bob ([#1167](https://github.com/hashicorp/terraform-ls/pull/1167)) -* build(deps): Bump golang.org/x/tools from 0.16.0 to 0.17.0 ([#1519](https://github.com/hashicorp/terraform-ls/pull/1519), [#1578](https://github.com/hashicorp/terraform-ls/pull/1578)) -* build(deps): Bump golang.org/x/crypto from 0.16.0 to 0.17.0 ([#1524](https://github.com/hashicorp/terraform-ls/pull/1524)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.18.0 to 0.20.0 ([#1541](https://github.com/hashicorp/terraform-ls/pull/1541), [#1547](https://github.com/hashicorp/terraform-ls/pull/1547)) -* build(deps): Bump github.com/hashicorp/terraform-exec from 0.19.0 to 0.20.0 ([#1543](https://github.com/hashicorp/terraform-ls/pull/1543)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.38.0 to 2.40.1 ([#1542](https://github.com/hashicorp/terraform-ls/pull/1542), [#1544](https://github.com/hashicorp/terraform-ls/pull/1544), [#1576](https://github.com/hashicorp/terraform-ls/pull/1576), [#1581](https://github.com/hashicorp/terraform-ls/pull/1581)) -* build(deps): Bump workflows to latest trusted versions ([#1520](https://github.com/hashicorp/terraform-ls/pull/1520), [#1571](https://github.com/hashicorp/terraform-ls/pull/1571), [#1579](https://github.com/hashicorp/terraform-ls/pull/1579)) -* Rename `hcl-typeCapsule` to `hcl-typeComplex` ([#1529](https://github.com/hashicorp/terraform-ls/pull/1529)) -* Rename `hcl-traversalStep` to `hcl-referenceStep` ([#1574](https://github.com/hashicorp/terraform-ls/pull/1574)) - -## 0.32.4 (12 December 2023) - -ENHANCEMENTS: - -* Add support for conditional expression ([hcl-lang#326](https://github.com/hashicorp/hcl-lang/pull/326)) -* Add support for template expressions ([hcl-lang#322](https://github.com/hashicorp/hcl-lang/pull/322)) -* Reflect new SSO endpoint override in S3 backend ([terraform-schema#302](https://github.com/hashicorp/terraform-schema/pull/302)) -* Reflect new proxy settings in S3 backend ([terraform-schema#301](https://github.com/hashicorp/terraform-schema/pull/301)) -* Reflect new `skip_s3_checksum` attribute in S3 backend ([terraform-schema#295](https://github.com/hashicorp/terraform-schema/pull/295)) - -BUG FIXES: - -* Improve traversal completion for lists, tuples, and sets ([hcl-lang#344](https://github.com/hashicorp/hcl-lang/pull/344)) -* Update version resolution for empty constraints ([terraform-schema#296](https://github.com/hashicorp/terraform-schema/pull/296)) - -INTERNAL: - -* Add new performance issue template ([#1499](https://github.com/hashicorp/terraform-ls/pull/1499)) -* go: Bump version to 1.21.4 ([#1511](https://github.com/hashicorp/terraform-ls/pull/1511)) -* github: Disable dependabot for GHA ([#1489](https://github.com/hashicorp/terraform-ls/pull/1489)) -* build(deps): Bump golang.org/x/tools from 0.14.0 to 0.15.0 ([#1491](https://github.com/hashicorp/terraform-ls/pull/1491), [#1513](https://github.com/hashicorp/terraform-ls/pull/1513)) -* build(deps): Bump workflows to latest trusted versions ([#1493](https://github.com/hashicorp/terraform-ls/pull/1493), [#1510](https://github.com/hashicorp/terraform-ls/pull/1510), [#1514](https://github.com/hashicorp/terraform-ls/pull/1514)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.36.1 to 2.38.0 ([#1498](https://github.com/hashicorp/terraform-ls/pull/1498), [#1500](https://github.com/hashicorp/terraform-ls/pull/1500), [#1509](https://github.com/hashicorp/terraform-ls/pull/1509)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.17.1 to 0.18.0 ([#1492](https://github.com/hashicorp/terraform-ls/pull/1492)) -* build(deps): Bump go.opentelemetry.io/otel from 1.19.0 to 1.20.0 ([#1494](https://github.com/hashicorp/terraform-ls/pull/1494)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.45.0 to 0.46.0 ([#1496](https://github.com/hashicorp/terraform-ls/pull/1496)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.45.0 to 0.46.0 ([#1497](https://github.com/hashicorp/terraform-ls/pull/1497)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.46.0 to 0.46.1 ([#1501](https://github.com/hashicorp/terraform-ls/pull/1501)) -* build(deps): Bump github.com/creachadair/jrpc2 from 1.1.1 to 1.1.2 ([#1504](https://github.com/hashicorp/terraform-ls/pull/1504)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.6.1 to 0.6.2 ([#1516](https://github.com/hashicorp/terraform-ls/pull/1516)) - -## 0.32.3 (7 November 2023) - -BUG FIXES: - -* Validate required attributes more selectively to relax `provider` validation ([#1485](https://github.com/hashicorp/terraform-ls/pull/1485)) -* Skip inferring variable type from default values ([hcl-lang#338](https://github.com/hashicorp/hcl-lang/pull/338)) -* Ensure partially unknown dependent body is handled ([hcl-lang#339](https://github.com/hashicorp/hcl-lang/pull/339)) -* Fix type-unaware target collection ([hcl-lang#340](https://github.com/hashicorp/hcl-lang/pull/340)) -* Allow variable references in `depends_on` ([terraform-schema#290](https://github.com/hashicorp/terraform-schema/pull/290)) -* Fix provider attribute to block conversion ([terraform-schema#288](https://github.com/hashicorp/terraform-schema/pull/288)) -* Skip inferring module inputs for default values ([terraform-schema#289](https://github.com/hashicorp/terraform-schema/pull/289)) -* Allow local references in `depends_on` ([terraform-schema#292](https://github.com/hashicorp/terraform-schema/pull/292)) - -INTERNAL: - -* go: bump version to 1.21.3 ([#1467](https://github.com/hashicorp/terraform-ls/pull/1467)) -* validations: Add link in comment to open issue ([#1472](https://github.com/hashicorp/terraform-ls/pull/1472)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.35.3 to 2.36.1 ([#1463](https://github.com/hashicorp/terraform-ls/pull/1463), [#1465](https://github.com/hashicorp/terraform-ls/pull/1465), [#1487](https://github.com/hashicorp/terraform-ls/pull/1487)) -* build(deps): Bump github.com/hashicorp/hcl/v2 from 2.18.1 to 2.19.1 ([#1466](https://github.com/hashicorp/terraform-ls/pull/1466), [#1468](https://github.com/hashicorp/terraform-ls/pull/1468)) -* build(deps): Bump actions/checkout from 4.1.0 to 4.1.1 ([#1469](https://github.com/hashicorp/terraform-ls/pull/1469)) -* build(deps): Bump github.com/hashicorp/terraform-registry-address from 0.2.2 to 0.2.3 ([#1482](https://github.com/hashicorp/terraform-ls/pull/1482)) - -## 0.32.2 (12 October 2023) - -ENHANCEMENTS: - -* Add `skip_requesting_account_id` to `s3` backend ([terraform-schema#279](https://github.com/hashicorp/terraform-schema/pull/279)) - -BUG FIXES: - -* Work around 'unreliable' input data for Registry modules ([#1456](https://github.com/hashicorp/terraform-ls/pull/1456)) -* Resolve version correctly for backend schema ([#1453](https://github.com/hashicorp/terraform-ls/pull/1453)) -* Allow objects in `for_each` ([hcl-lang#333](https://github.com/hashicorp/hcl-lang/pull/333)) -* Fix `output` block `precondition` in 1.2 schema ([terraform-schema#282](https://github.com/hashicorp/terraform-schema/pull/282)) - -INTERNAL: - -* build(deps): Bump github.com/vektra/mockery/v2 from 2.35.1 to 2.35.3 ([#1451](https://github.com/hashicorp/terraform-ls/pull/1451), [#1452](https://github.com/hashicorp/terraform-ls/pull/1452)) -* build(deps): Bump golang.org/x/tools from 0.13.0 to 0.14.0 ([#1450](https://github.com/hashicorp/terraform-ls/pull/1450)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.6.0 to 0.6.1 ([#1454](https://github.com/hashicorp/terraform-ls/pull/1454)) -* build(deps): Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 ([#1457](https://github.com/hashicorp/terraform-ls/pull/1457)) -* build(deps): Bump golang.org/x/net from 0.16.0 to 0.17.0 ([#1460](https://github.com/hashicorp/terraform-ls/pull/1460)) - -## 0.32.1 (6 October 2023) - -ENHANCEMENTS: - -* decoder: Add support for binary & unary operators ([hcl-lang#320](https://github.com/hashicorp/hcl-lang/pull/320)) - -BUG FIXES: - -* Fix incorrect schema for `terraform_remote_state` data source ([terraform-schema#272](https://github.com/hashicorp/terraform-schema/pull/272)) -* Make `cloud` `organization` optional ([terraform-schema#271](https://github.com/hashicorp/terraform-schema/pull/271)) -* Ensure empty objects & tuples still get recognised ([hcl-lang#330](https://github.com/hashicorp/hcl-lang/pull/330)) -* Introduce default value `"ssh"` for `type` under `connection` block to enable recognition of attributes such as `bastion_host` even when `type` is not declared ([hcl-lang#327](https://github.com/hashicorp/hcl-lang/pull/327), [terraform-schema#270](https://github.com/hashicorp/terraform-schema/pull/270)) -* Introduce v1.3 proxy related fields for provisioner `connection` block ([terraform-schema#269](https://github.com/hashicorp/terraform-schema/pull/269)) -* Ensure `target_platform` is recognised in nested `connection` block ([terraform-schema#268](https://github.com/hashicorp/terraform-schema/pull/268)) - -## 0.32.0 (4 October 2023) - -ENHANCEMENTS: - -* Enhanced validation provides additional diagnostics for [selected invalid Terraform language constructs](https://github.com/hashicorp/terraform-ls/blob/v0.32.0/docs/validation.md#enhanced-validation) based on detected Terraform version and provider versions are provided. ([#1368](https://github.com/hashicorp/terraform-ls/pull/1368)) -* Improve performance by parsing changed `*.tf` file (as opposed to all files in the module) ([#1404](https://github.com/hashicorp/terraform-ls/pull/1404)) -* Improve performance by parsing changed `*.tfvars` file (as opposed to all files in the directory) ([#1422](https://github.com/hashicorp/terraform-ls/pull/1422)) -* Add `project` attribute to workspaces block ([terraform-schema#257](https://github.com/hashicorp/terraform-schema/pull/257)) -* Update `import` ID to be interpolatable ([terraform-schema#260](https://github.com/hashicorp/terraform-schema/pull/260)) -* Add `nullable` to `variable` blocks for `v1.1+` ([terraform-schema#261](https://github.com/hashicorp/terraform-schema/pull/261)) -* Add `endpoint` and `domain` to `cos` backend ([terraform-schema#262](https://github.com/hashicorp/terraform-schema/pull/262)) -* Add `proxy_url` to `kubernetes` backend ([terraform-schema#263](https://github.com/hashicorp/terraform-schema/pull/263)) -* Update `s3` backend with `v1.6` changes ([terraform-schema#265](https://github.com/hashicorp/terraform-schema/pull/265)) - -BUG FIXES: - -* Allow `list(any)` to be passed into `dynamic` block's `for_each` ([hcl-lang#313](https://github.com/hashicorp/hcl-lang/pull/313)) -* Make `dynamic` `content` block required ([hcl-lang#314](https://github.com/hashicorp/hcl-lang/pull/314)) -* indexer: Ensure declared module calls get decoded ([#1395](https://github.com/hashicorp/terraform-ls/pull/1395)) - -INTERNAL: - -* go: bump version to `1.21.1` ([#1408](https://github.com/hashicorp/terraform-ls/pull/1408)) -* build(deps): Bump actions/checkout from 3.6.0 to 4.1.0 ([#1382](https://github.com/hashicorp/terraform-ls/pull/1382), [#1420](https://github.com/hashicorp/terraform-ls/pull/1420)) -* build(deps): Bump actions/upload-artifact from 3.1.2 to 3.1.3 ([#1393](https://github.com/hashicorp/terraform-ls/pull/1393)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.30.1 to 3.31.0 ([#1387](https://github.com/hashicorp/terraform-ls/pull/1387)) -* build(deps): Bump github.com/otiai10/copy from 1.12.0 to 1.14.0 ([#1432](https://github.com/hashicorp/terraform-ls/pull/1432)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.33.0 to 2.34.2 ([#1388](https://github.com/hashicorp/terraform-ls/pull/1388), [#1411](https://github.com/hashicorp/terraform-ls/pull/1411), [#1419](https://github.com/hashicorp/terraform-ls/pull/1419), [#1421](https://github.com/hashicorp/terraform-ls/pull/1421), [#1423](https://github.com/hashicorp/terraform-ls/pull/1423)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace from 0.42.0 to 0.45.0 ([#1390](https://github.com/hashicorp/terraform-ls/pull/1390), [#1405](https://github.com/hashicorp/terraform-ls/pull/1405), [#1430](https://github.com/hashicorp/terraform-ls/pull/1430)) -* build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.42.0 to 0.43.0 ([#1385](https://github.com/hashicorp/terraform-ls/pull/1385)) -* build(deps): Bump go.opentelemetry.io/otel from 1.17.0 to 1.19.0 ([#1401](https://github.com/hashicorp/terraform-ls/pull/1401), [#1428](https://github.com/hashicorp/terraform-ls/pull/1428)) -* build(deps): Bump go.opentelemetry.io/otel/trace from 1.16.0 to 1.17.0 ([#1389](https://github.com/hashicorp/terraform-ls/pull/1389)) -* build(deps): Bump golang.org/x/tools from 0.12.0 to 0.13.0 ([#1386](https://github.com/hashicorp/terraform-ls/pull/1386)) - -## 0.31.5 (4 September 2023) - -ENHANCEMENTS: - -* jobs: Improve `PreloadEmbeddedSchema` performance ([#1369](https://github.com/hashicorp/terraform-ls/pull/1369)) -* langserver: Avoid re-processing open files after file saving to improve performance ([#1372](https://github.com/hashicorp/terraform-ls/pull/1372)) - -INTERNAL: - -* go: Bump version to 1.21 ([#1355](https://github.com/hashicorp/terraform-ls/pull/1355)) -* Bump terraform-schema and hcl-lang ([#1350](https://github.com/hashicorp/terraform-ls/pull/1350), [#1374](https://github.com/hashicorp/terraform-ls/pull/1374)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.32.0 to 2.33.0 ([#1345](https://github.com/hashicorp/terraform-ls/pull/1345), [#1348](https://github.com/hashicorp/terraform-ls/pull/1348), [#1356](https://github.com/hashicorp/terraform-ls/pull/1356), [#1360](https://github.com/hashicorp/terraform-ls/pull/1360)) -* build(deps): Bump golang.org/x/tools from 0.11.1 to 0.12.0 ([#1351](https://github.com/hashicorp/terraform-ls/pull/1351)) -* build(deps): Bump actions/setup-go from 4.0.1 to 4.1.0 ([#1354](https://github.com/hashicorp/terraform-ls/pull/1354)) -* build(deps): Bump github.com/creachadair/jrpc2 from 1.1.0 to 1.1.1 ([#1359](https://github.com/hashicorp/terraform-ls/pull/1359)) -* build(deps): Bump actions/checkout from 3.5.3 to 3.6.0 ([#1362](https://github.com/hashicorp/terraform-ls/pull/1362)) - -## 0.31.4 (1 August 2023) - -ENHANCEMENTS: - -* OTEL instrumentation (currently no-op for end-users) ([#1327](https://github.com/hashicorp/terraform-ls/pull/1327), [#1334](https://github.com/hashicorp/terraform-ls/pull/1334)) -* jobs: Don't wait for `GetModuleDataFromRegistry` job to improve performance ([#1332](https://github.com/hashicorp/terraform-ls/pull/1332)) - -INTERNAL: - -* build(deps): Bump golang.org/x/tools from 0.11.0 to 0.11.1 ([#1342](https://github.com/hashicorp/terraform-ls/pull/1342)) -* deps: Bump terraform-schema to `8234469` ([#1343](https://github.com/hashicorp/terraform-ls/pull/1343)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.30.1 to 2.30.16 ([#1319](https://github.com/hashicorp/terraform-ls/pull/1319)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.17.0 to 0.17.1 ([#1320](https://github.com/hashicorp/terraform-ls/pull/1320)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.30.0 to 3.30.1 ([#1322](https://github.com/hashicorp/terraform-ls/pull/1322)) -* build(deps): Bump golang.org/x/tools from 0.10.0 to 0.11.0 ([#1323](https://github.com/hashicorp/terraform-ls/pull/1323)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.30.16 to 2.30.17 ([#1325](https://github.com/hashicorp/terraform-ls/pull/1325)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.30.17 to 2.31.1 ([#1326](https://github.com/hashicorp/terraform-ls/pull/1326)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.31.1 to 2.31.4 ([#1328](https://github.com/hashicorp/terraform-ls/pull/1328)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.31.4 to 2.32.0 ([#1329](https://github.com/hashicorp/terraform-ls/pull/1329)) -* build(deps): Bump github.com/creachadair/jrpc2 from 1.0.1 to 1.1.0 ([#1330](https://github.com/hashicorp/terraform-ls/pull/1330)) -* Change `nvim_create_autocmd` callback to a lambda ([#1295](https://github.com/hashicorp/terraform-ls/pull/1295)) -* Fix link in README.md ([#1324](https://github.com/hashicorp/terraform-ls/pull/1324)) - -## 0.31.3 (20 June 2023) - -ENHANCEMENTS: - -* Introduce v1.5 `check` block ([#229](https://github.com/hashicorp/terraform-schema/pull/229)) -* Introduce v1.5 `import` block ([#228](https://github.com/hashicorp/terraform-schema/pull/228)) -* Re-generate function signatures for v1.5 ([#213](https://github.com/hashicorp/terraform-schema/pull/213)) -* Add v1.4 `local-exec` provisioner `quiet` attribute ([#218](https://github.com/hashicorp/terraform-schema/pull/218)) -* Reflect 1.4 changes in `gcs` backend ([#227](https://github.com/hashicorp/terraform-schema/pull/227)) -* Reflect 1.4 changes in `http` backend ([#226](https://github.com/hashicorp/terraform-schema/pull/226)) -* Reflect 1.3 & 1.4 changes in `cos` backend ([#217](https://github.com/hashicorp/terraform-schema/pull/217)) -* Reflect 1.2 & 1.3 changes in `azurerm` backend ([#225](https://github.com/hashicorp/terraform-schema/pull/225)) - -INTERNAL: -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.29.1 to 3.29.2 ([#1281](https://github.com/hashicorp/terraform-ls/pull/1281)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.29.2 to 3.29.4 ([#1289](https://github.com/hashicorp/terraform-ls/pull/1289)) -* build(deps): Bump github.com/algolia/algoliasearch-client-go/v3 from 3.29.4 to 3.30.0 ([#1305](https://github.com/hashicorp/terraform-ls/pull/1305)) -* build(deps): Bump github.com/hashicorp/hc-install from 0.5.1 to 0.5.2 ([#1282](https://github.com/hashicorp/terraform-ls/pull/1282)) -* build(deps): Bump github.com/hashicorp/hcl/v2 from 2.16.2 to 2.17.0 ([#1298](https://github.com/hashicorp/terraform-ls/pull/1298)) -* build(deps): Bump github.com/hashicorp/terraform-json from 0.16.0 to 0.17.0 ([#1308](https://github.com/hashicorp/terraform-ls/pull/1308)) -* build(deps): Bump github.com/hashicorp/terraform-registry-address from 0.2.0 to 0.2.1 ([#1311](https://github.com/hashicorp/terraform-ls/pull/1311)) -* build(deps): Bump github.com/otiai10/copy from 1.11.0 to 1.12.0 ([#1313](https://github.com/hashicorp/terraform-ls/pull/1313)) -* build(deps): Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 ([#1288](https://github.com/hashicorp/terraform-ls/pull/1288)) -* build(deps): Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 ([#1294](https://github.com/hashicorp/terraform-ls/pull/1294)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.26.1 to 2.27.1 ([#1285](https://github.com/hashicorp/terraform-ls/pull/1285)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.27.1 to 2.28.1 ([#1293](https://github.com/hashicorp/terraform-ls/pull/1293)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.28.1 to 2.28.2 ([#1302](https://github.com/hashicorp/terraform-ls/pull/1302)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.28.2 to 2.29.0 ([#1306](https://github.com/hashicorp/terraform-ls/pull/1306)) -* build(deps): Bump github.com/vektra/mockery/v2 from 2.29.0 to 2.30.1 ([#1310](https://github.com/hashicorp/terraform-ls/pull/1310)) -* build(deps): Bump github.com/zclconf/go-cty from 1.13.1 to 1.13.2 ([#1290](https://github.com/hashicorp/terraform-ls/pull/1290)) -* build(deps): Bump golang.org/x/tools from 0.9.1 to 0.9.2 ([#1299](https://github.com/hashicorp/terraform-ls/pull/1299)) -* build(deps): Bump golang.org/x/tools from 0.9.2 to 0.9.3 ([#1301](https://github.com/hashicorp/terraform-ls/pull/1301)) -* build(deps): Bump golang.org/x/tools from 0.9.3 to 0.10.0 ([#1312](https://github.com/hashicorp/terraform-ls/pull/1312)) - -## 0.31.2 (11 May 2023) - -BUG FIXES: - -* Fix crash on prefix completion ([hcl-lang#275](https://github.com/hashicorp/hcl-lang/pull/275)) - -INTERNAL: - -* Remove automated milestone closure commenting ([#1266](https://github.com/hashicorp/terraform-ls/pull/1266)) - -## 0.31.1 (27 April 2023) - -ENHANCEMENTS: - -* Cache registry module errors to improve performance in cases of private registry, submodules or other similar situations resulting in module data unavailability ([#1258](https://github.com/hashicorp/terraform-ls/pull/1258)) - -BUG FIXES: - -* Pull in gopls v0.10.0 tsprotocol.go to fix completion labels ([#1256](https://github.com/hashicorp/terraform-ls/pull/1256)) - -INTERNAL: - -* Add PR test for copyright headers ([#1241](https://github.com/hashicorp/terraform-ls/pull/1241)) - -## 0.31.0 (18 April 2023) - -ENHANCEMENTS: - -* Add support for nested expressions and functions ([#1237](https://github.com/hashicorp/terraform-ls/pull/1237), [hcl-lang#232](https://github.com/hashicorp/hcl-lang/pull/232), [hcl-lang#203](https://github.com/hashicorp/hcl-lang/pull/203), [hcl-lang#199](https://github.com/hashicorp/hcl-lang/pull/199), [hcl-lang#186](https://github.com/hashicorp/hcl-lang/pull/186), [hcl-lang#185](https://github.com/hashicorp/hcl-lang/pull/185), [hcl-lang#184](https://github.com/hashicorp/hcl-lang/pull/184)) -* Add support for function signature help in ([#1077](https://github.com/hashicorp/terraform-ls/pull/1077)) -* Fix remote backend tracking in ([#1218](https://github.com/hashicorp/terraform-ls/pull/1218)) -* lsp: Recognise new token type for function names in ([#1233](https://github.com/hashicorp/terraform-ls/pull/1233)) - -INTERNAL: - -* Add instructions for Kate editor ([#1200](https://github.com/hashicorp/terraform-ls/pull/1200)) -* Add TFC usage detection ([#1208](https://github.com/hashicorp/terraform-ls/pull/1208)) - -BUG FIXES: - -* Reflect `LiteralValue`, `Description` & `IsDeprecated` in completion/hover ([hcl-lang#253](https://github.com/hashicorp/hcl-lang/pull/253)) -* Fix crash when completing `LiteralType{Type: cty.Tuple}` ([hcl-lang#255](https://github.com/hashicorp/hcl-lang/pull/255)) -* Display `Tuple` hover data on invalid element ([hcl-lang#254](https://github.com/hashicorp/hcl-lang/pull/254)) -* Fix collection of implied declared targets of complex types ([hcl-lang#259](https://github.com/hashicorp/hcl-lang/pull/259)) -* Collect targets w/ interpolation for `Any` correctly ([hcl-lang#257](https://github.com/hashicorp/hcl-lang/pull/257)) - -## 0.31.0-beta (6 April 2023) - -ENHANCEMENTS: - -* Add support for nested expressions and functions ([#1237](https://github.com/hashicorp/terraform-ls/pull/1237), [hcl-lang#232](https://github.com/hashicorp/hcl-lang/pull/232), [hcl-lang#203](https://github.com/hashicorp/hcl-lang/pull/203), [hcl-lang#199](https://github.com/hashicorp/hcl-lang/pull/199), [hcl-lang#186](https://github.com/hashicorp/hcl-lang/pull/186), [hcl-lang#185](https://github.com/hashicorp/hcl-lang/pull/185), [hcl-lang#184](https://github.com/hashicorp/hcl-lang/pull/184), ) -* Add support for function signature help in ([#1077](https://github.com/hashicorp/terraform-ls/pull/1077)) -* Fix remote backend tracking in ([#1218](https://github.com/hashicorp/terraform-ls/pull/1218)) -* lsp: Recognise new token type for function names in ([#1233](https://github.com/hashicorp/terraform-ls/pull/1233)) - -INTERNAL: - -* Add instructions for Kate editor ([#1200](https://github.com/hashicorp/terraform-ls/pull/1200)) -* Add TFC usage detection ([#1208](https://github.com/hashicorp/terraform-ls/pull/1208)) -* build(deps): bump actions/checkout from 3.3.0 to 3.4.0 ([#1215](https://github.com/hashicorp/terraform-ls/pull/1215)) -* build(deps): bump actions/checkout from 3.4.0 to 3.5.0 ([#1228](https://github.com/hashicorp/terraform-ls/pull/1228)) -* build(deps): bump actions/setup-go from 3.5.0 to 4.0.0 ([#1214](https://github.com/hashicorp/terraform-ls/pull/1214)) -* build(deps): bump actions/stale from 7.0.0 to 8.0.0 ([#1222](https://github.com/hashicorp/terraform-ls/pull/1222)) -* build(deps): bump github.com/algolia/algoliasearch-client-go/v3 from 3.26.3 to 3.26.4 ([#1198](https://github.com/hashicorp/terraform-ls/pull/1198)) -* build(deps): bump github.com/algolia/algoliasearch-client-go/v3 from 3.26.4 to 3.26.5 ([#1230](https://github.com/hashicorp/terraform-ls/pull/1230)) -* build(deps): bump github.com/algolia/algoliasearch-client-go/v3 from 3.26.5 to 3.27.0 ([#1231](https://github.com/hashicorp/terraform-ls/pull/1231)) -* build(deps): bump github.com/creachadair/jrpc2 from 0.44.0 to 0.45.0 ([#1213](https://github.com/hashicorp/terraform-ls/pull/1213)) -* build(deps): bump github.com/creachadair/jrpc2 from 0.46.0 to 1.0.0 ([#1227](https://github.com/hashicorp/terraform-ls/pull/1227)) -* build(deps): bump github.com/creachadair/jrpc2 to v0.46.0 ([#1217](https://github.com/hashicorp/terraform-ls/pull/1217)) -* build(deps): bump github.com/hashicorp/hc-install from 0.5.0 to 0.5.1 ([#1232](https://github.com/hashicorp/terraform-ls/pull/1232)) -* build(deps): bump github.com/hashicorp/hcl/v2 from 2.16.1 to 2.16.2 ([#1205](https://github.com/hashicorp/terraform-ls/pull/1205)) -* build(deps): bump github.com/hashicorp/terraform-exec from 0.18.0 to 0.18.1 ([#1201](https://github.com/hashicorp/terraform-ls/pull/1201)) -* build(deps): bump github.com/hashicorp/terraform-json from 0.15.0 to 0.16.0 ([#1206](https://github.com/hashicorp/terraform-ls/pull/1206)) -* build(deps): bump github.com/hashicorp/terraform-registry-address from 0.0.0-20220623143253-7d51757b572c to 0.1.0 ([#1196](https://github.com/hashicorp/terraform-ls/pull/1196)) -* build(deps): bump github.com/hashicorp/terraform-registry-address from 0.1.0 to 0.2.0 ([#1226](https://github.com/hashicorp/terraform-ls/pull/1226)) -* build(deps): bump github.com/otiai10/copy from 1.9.0 to 1.10.0 ([#1236](https://github.com/hashicorp/terraform-ls/pull/1236)) -* build(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 ([#1199](https://github.com/hashicorp/terraform-ls/pull/1199)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.20.2 to 2.21.1 ([#1202](https://github.com/hashicorp/terraform-ls/pull/1202)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.21.1 to 2.21.4 ([#1204](https://github.com/hashicorp/terraform-ls/pull/1204)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.21.4 to 2.21.6 ([#1207](https://github.com/hashicorp/terraform-ls/pull/1207)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.21.6 to 2.22.1 ([#1209](https://github.com/hashicorp/terraform-ls/pull/1209)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.22.1 to 2.23.0 ([#1219](https://github.com/hashicorp/terraform-ls/pull/1219)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.23.0 to 2.23.1 ([#1221](https://github.com/hashicorp/terraform-ls/pull/1221)) -* build(deps): bump github.com/vektra/mockery/v2 from 2.23.1 to 2.23.2 ([#1235](https://github.com/hashicorp/terraform-ls/pull/1235)) -* build(deps): bump github.com/zclconf/go-cty from 1.12.1 to 1.13.0 ([#1197](https://github.com/hashicorp/terraform-ls/pull/1197)) -* build(deps): bump github.com/zclconf/go-cty from 1.13.0 to 1.13.1 ([#1216](https://github.com/hashicorp/terraform-ls/pull/1216)) -* build(deps): bump golang.org/x/tools from 0.6.0 to 0.7.0 ([#1203](https://github.com/hashicorp/terraform-ls/pull/1203)) -* build(deps): Bump hcl-lang & terraform-schema to latest revisions ([#1237](https://github.com/hashicorp/terraform-ls/pull/1237)) - -## 0.30.3 (22 February 2023) - -BUG FIXES: - - - Enable static builds of Linux binaries (again) ([#1193](https://github.com/hashicorp/terraform-ls/pull/1193)) - -## 0.30.2 (15 February 2023) - -NOTES / BREAKING CHANGES: - - - We have changed our release process: all assets continue to be available from the [HashiCorp Releases site](https://releases.hashicorp.com/terraform-ls) and/or via the [Releases API](https://releases.hashicorp.com/docs/api/v1/), not as GitHub Release assets anymore. - -ENHANCEMENTS: - - - Parse `optional()` object attribute _default values_ correctly, as introduced in Terraform v1.3 ([terraform-schema#184](https://github.com/hashicorp/terraform-schema/pull/184)) - -BUG FIXES: - - - Ignore inaccessible files (such as emacs backup files) ([terraform-ls#1172](https://github.com/hashicorp/terraform-ls/issues/1067])) - - Fix crash when parsing JSON files (introduced in 0.30.0) ([hcl-lang#202](https://github.com/hashicorp/hcl-lang/pull/202])) - -INTERNAL: - - - Remove `schema.TupleConsExpr` ([hcl-lang#175](https://github.com/hashicorp/hcl-lang/pull/175)) - - internal/schema: Replace `TupleConsExpr` with `SetExpr` ([terraform-schema#169](https://github.com/hashicorp/terraform-schema/pull/169)) - - Use upstreamed HCL typexpr package ([terraform-schema#168](https://github.com/hashicorp/terraform-schema/pull/168)) - -## 0.30.1 (1 December 2022) - -BUG FIXES: - - - Support `dynamic` in the `provisioner` and `provider` blocks ([terraform-schema#165](https://github.com/hashicorp/terraform-schema/pull/165)) - - Fix `dynamic` block `for_each` description ([hcl-lang#164](https://github.com/hashicorp/hcl-lang/pull/164)) - - Avoid completing static block inside a `dynamic` label ([hcl-lang#165](https://github.com/hashicorp/hcl-lang/pull/165)) - - Fix missing hover for `count` and `for_each` expression ([hcl-lang#166](https://github.com/hashicorp/hcl-lang/pull/166)) - - Fix support of deeper nesting of `dynamic` block ([hcl-lang#167](https://github.com/hashicorp/hcl-lang/pull/167)) - - Change `dynamic` block type to default ([hcl-lang#168](https://github.com/hashicorp/hcl-lang/pull/168)) - -## 0.30.0 (24 November 2022) - -ENHANCEMENTS: - - - Support `count.index` references in blocks with `count` for completion, hover documentation and semantic tokens highlighting ([#860](https://github.com/hashicorp/terraform-ls/issues/860), [hcl-lang#160](https://github.com/hashicorp/hcl-lang/pull/160)) - - Support `each.*` references in blocks with `for_each` for completion, hover documentation and semantic tokens highlighting ([#861](https://github.com/hashicorp/terraform-ls/issues/861), [hcl-lang#162](https://github.com/hashicorp/hcl-lang/pull/162)) - - Support `self.*` references in `provisioner`, `connection` and `postcondition` blocks for completion, hover documentation and semantic tokens highlighting ([#859](https://github.com/hashicorp/terraform-ls/issues/859), [hcl-lang#163](https://github.com/hashicorp/hcl-lang/pull/163)) - - `dynamic` block support, including label and content completion ([#530](https://github.com/hashicorp/terraform-ls/issues/530), [hcl-lang#154](https://github.com/hashicorp/hcl-lang/pull/154)) - - Go-to-definition/go-to-references for `count.index`/`count` ([#1093](https://github.com/hashicorp/terraform-ls/issues/1093)) - - Go-to-definition/go-to-references for `each.*`/`for_each` ([#1095](https://github.com/hashicorp/terraform-ls/issues/1095)) - - Go-to-definition/go-to-references for `self.*` in `provisioner`, `connection` and `postcondition` blocks ([#1096](https://github.com/hashicorp/terraform-ls/issues/1096)) - - Remove deprecated backends in Terraform 1.3.0 ([terraform-schema#159](https://github.com/hashicorp/terraform-schema/pull/159)) - -## 0.29.3 (13 October 2022) - -ENHANCEMENTS: - - - schemas: Lazy-load embedded provider schemas ([#1071](https://github.com/hashicorp/terraform-ls/pull/1071)) - - Reduced runtime memory consumption from static ~572MB (representing ~220 providers) to more dynamic depending on providers in use. - For example, no configuration (no provider requirements) should consume around 10MB, indexed folder w/ `hashicorp/aws` requirement ~70MB. - - Reduced launch time from ~ 2 seconds to 1-3 ms. - -BUG FIXES: - - - fix: Enable IntelliSense for resources & data sources whose name match the provider (e.g. `data`) ([#1072](https://github.com/hashicorp/terraform-ls/pull/1072)) - - state: avoid infinite recursion (surfaced as crash with "goroutine stack exceeds 1000000000-byte limit" message) ([#1084](https://github.com/hashicorp/terraform-ls/pull/1084)) - - decoder: fix race condition in terraform-schema (surfaced as crash with "fatal error: concurrent map read and map write" message) ([#1086](https://github.com/hashicorp/terraform-ls/pull/1086)) - -## 0.29.2 (7 September 2022) - -BUG FIXES: - - - fix: Improve IntelliSense accuracy by tracking provider schema versions (accidentally removed in 0.29.0) ([#1060](https://github.com/hashicorp/terraform-ls/pull/1060)) - - Don't query the Terraform Registry for module sources starting with `.` ([#1062](https://github.com/hashicorp/terraform-ls/pull/1062)) - - fix race condition in schema merging ([terraform-schema#137](https://github.com/hashicorp/terraform-schema/pull/137)) - -INTERNAL: - - - Use Go 1.19 (previously 1.17) to build the server ([#1046](https://github.com/hashicorp/terraform-ls/pull/1046)) - -## 0.29.1 (24 August 2022) - -ENHANCEMENTS: - - - docs: Add link to post explaining vim plugin installation ([#1044](https://github.com/hashicorp/terraform-ls/pull/1044)) - -BUG FIXES: - - - goreleaser: Use correct ldflag (versionPrerelease) when compiling LS ([#1043](https://github.com/hashicorp/terraform-ls/pull/1043)) - - Fix panic on obtaining provider schemas ([#1048](https://github.com/hashicorp/terraform-ls/pull/1048)) - -INTERNAL: - - - cleanup: Remove LogHandler ([#1038](https://github.com/hashicorp/terraform-ls/pull/1038)) - -## 0.29.0 (11 August 2022) - -NOTES / BREAKING CHANGES: - - - settings: `rootModulePaths` option was deprecated and is ignored. Users should instead leverage the workspace LSP API and add the folder to a workspace, if they wish it to be indexed ([#1003](https://github.com/hashicorp/terraform-ls/pull/1003)) - - settings: `excludeModulePaths` option was deprecated in favour of `indexing.ignorePaths`. `excludeModulePaths` is now ignored ([#1003](https://github.com/hashicorp/terraform-ls/pull/1003)) - - settings: `ignoreDirectoryNames` option was deprecated in favour of [`indexing.ignoreDirectoryNames`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#ignoredirectorynames-string). `ignoreDirectoryNames` is now ignored ([#1003](https://github.com/hashicorp/terraform-ls/pull/1003), [#1010](https://github.com/hashicorp/terraform-ls/pull/1010)) - - settings: `terraformExecPath` option was deprecated in favour of [`terraform.path`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#path-string). Old option is now ignored. ([#1011](https://github.com/hashicorp/terraform-ls/pull/1011)) - - settings: `terraformExecTimeout` option was deprecated in favour of [`terraform.timeout`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#timeout-string). Old option is now ignored. ([#1011](https://github.com/hashicorp/terraform-ls/pull/1011)) - - settings: `terraformLogFilePath` option was deprecated in favour of [`terraform.logFilePath`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#logfilepath-string). Old option is now ignored. ([#1011](https://github.com/hashicorp/terraform-ls/pull/1011)) - - cmd/serve: Previously deprecated `-tf-exec*` CLI flags were removed (`-tf-exec`, `-tf-exec-timeout` and `-tf-log-file`) in favour of LSP-based [`terraform.*`](https://github.com/hashicorp/terraform-ls/blob/main/docs/SETTINGS.md#terraform-object-) configuration options ([#1012](https://github.com/hashicorp/terraform-ls/pull/1012)) - -ENHANCEMENTS: - - - Replace internal watcher (used for watching changes in installed plugins and modules) with LSP dynamic capability registration & `workspace/didChangeWatchedFiles`. This should leave to improved performance in most cases. ([#953](https://github.com/hashicorp/terraform-ls/pull/953)) - - Provide completion, hover and docs links for uninitialized Registry modules ([#924](https://github.com/hashicorp/terraform-ls/pull/924)) - - Provide basic IntelliSense (except for diagnostics) for hidden `*.tf` files ([#971](https://github.com/hashicorp/terraform-ls/pull/971)) - - deps: bump terraform-schema to introduce v1.1 `terraform` `cloud` block ([terraform-schema#117](https://github.com/hashicorp/terraform-schema/pull/117)) - - deps: bump terraform-schema to introduce v1.1 `moved` block ([terraform-schema#121](https://github.com/hashicorp/terraform-schema/pull/121)) - - deps: bump terraform-schema to introduce v1.2 `lifecycle` conditions ([terraform-schema#115](https://github.com/hashicorp/terraform-schema/pull/115)) - - deps: bump terraform-schema to introduce v1.2 `lifecycle` `replace_triggered_by` ([terraform-schema#123](https://github.com/hashicorp/terraform-schema/pull/123)) - - Use `module` declarations from parsed configuration as source of truth for `module.calls` ([#987](https://github.com/hashicorp/terraform-ls/pull/987)) - - walker: Index uninitialized modules ([#997](https://github.com/hashicorp/terraform-ls/pull/997)) - - Recognize inputs and outputs of uninitialized local modules ([#598](https://github.com/hashicorp/terraform-ls/issues/598)) - - Enable go to module output declaration from reference ([#1007](https://github.com/hashicorp/terraform-ls/issues/1007)) - - settings: New option [`indexing.ignorePaths`](https://github.com/hashicorp/terraform-ls/blob/v0.29.0/docs/SETTINGS.md#ignorepaths-string) was introduced ([#1003](https://github.com/hashicorp/terraform-ls/pull/1003), [#1010](https://github.com/hashicorp/terraform-ls/pull/1010)) - - Introduce `module.terraform` custom LSP command to expose Terraform requirements & version ([#1016](https://github.com/hashicorp/terraform-ls/pull/1016)) - - Avoid obtaining schema via Terraform CLI if the same version is already cached (based on plugin lock file) ([#1014](https://github.com/hashicorp/terraform-ls/pull/1014)) - - Avoid getting version via `terraform version` during background indexing and pick relevant IntelliSense data based on `required_version` constraint ([#1027](https://github.com/hashicorp/terraform-ls/pull/1027)) - - Provide 0.12 based IntelliSense for any <0.12 Terraform versions ([#1027](https://github.com/hashicorp/terraform-ls/pull/1027)) - - Complete module source and version attributes for local and registry modules ([#1024](https://github.com/hashicorp/terraform-ls/pull/1024)) - -BUG FIXES: - - - handlers/command: Return partially parsed metadata from `module.providers` ([#951](https://github.com/hashicorp/terraform-ls/pull/951)) - - fix: Avoid ignoring hidden `*.tfvars` files ([#968](https://github.com/hashicorp/terraform-ls/pull/968)) - - fix: Avoid crash on invalid URIs ([#969](https://github.com/hashicorp/terraform-ls/pull/969)) - - fix: Avoid crash on invalid provider name ([#1030](https://github.com/hashicorp/terraform-ls/pull/1030)) - -INTERNAL: - - - job: introduce explicit priority for jobs ([#977](https://github.com/hashicorp/terraform-ls/pull/977)) - - main: allow build version metadata to be set ([#945](https://github.com/hashicorp/terraform-ls/pull/945)) - - deps: switch to the new minimal `terraform-registry-address` API ([#949](https://github.com/hashicorp/terraform-ls/pull/949)) - - deps: bump LSP structs to match gopls 0.8.4 ([#947](https://github.com/hashicorp/terraform-ls/pull/947)) - - deps: bump github.com/hashicorp/terraform-exec from 0.16.1 to 0.17.0 ([#963](https://github.com/hashicorp/terraform-ls/pull/963)) - - deps: bump github.com/hashicorp/go-version from 1.5.0 to 1.6.0 ([#979](https://github.com/hashicorp/terraform-ls/pull/979)) - - indexer: refactor & improve/cleanup error handling ([#988](https://github.com/hashicorp/terraform-ls/pull/988)) - - indexer/walker: Avoid running jobs where not needed ([#1006](https://github.com/hashicorp/terraform-ls/pull/1006)) - -## 0.28.1 (9 June 2022) - -Due to some release pipeline changes and multiple release attempts, `0.28.0` release was published with checksums mismatching the release artifacts. - -This release is therefore equivalent to `v0.28.0`, but published with the correct checksums. - -## 0.28.0 (7 June 2022) - -ENHANCEMENTS: - - Link to documentation from module source for registry modules ([#874](https://github.com/hashicorp/terraform-ls/pull/874)) - - Provide refresh mechanism for `module.providers` when providers change ([#902](https://github.com/hashicorp/terraform-ls/pull/902)) - - Provide refresh mechanism for `module.calls` when module calls change ([#909](https://github.com/hashicorp/terraform-ls/pull/909)) - - Add support for `workspace/didChangeWatchedFiles` notifications for `*.tf` & `*.tfvars` ([#790](https://github.com/hashicorp/terraform-ls/pull/790)) - - Improve performance by reducing amount of notifications sent for any single module changes ([#931](https://github.com/hashicorp/terraform-ls/pull/931)) - -BUG FIXES: - - Ignore duplicate document versions in `textDocument/didChange` ([#940](https://github.com/hashicorp/terraform-ls/pull/940)) - -INTERNAL: - - build(deps): bump github.com/mitchellh/cli from 1.1.2 to 1.1.3 ([#886](https://github.com/hashicorp/terraform-ls/pull/886)) - - Use `terraform-registry-address` for parsing module sources ([#891](https://github.com/hashicorp/terraform-ls/pull/891)) - - Add utm parameters to docs links in `module.*` commands ([#923](https://github.com/hashicorp/terraform-ls/pull/923)) - -## 0.27.0 (14 April 2022) - -NOTES / BREAKING CHANGES: - - - langserver/handlers/command: Remove `rootmodules` command ([#846](https://github.com/hashicorp/terraform-ls/pull/846)) - - cmd: Remove `completion` CLI command ([#852](https://github.com/hashicorp/terraform-ls/pull/852)) - -ENHANCEMENTS: - - - Provide (opt-in) custom semantic tokens & modifiers ([#833](https://github.com/hashicorp/terraform-ls/pull/833)) - - Enable 'go to module source' for local modules (via [#849](https://github.com/hashicorp/terraform-ls/pull/849)) - - Enable opening a single Terraform file ([#843](https://github.com/hashicorp/terraform-ls/pull/843)) - -BUG FIXES: - - - Avoid hanging when workspace contains >50 folders ([#839](https://github.com/hashicorp/terraform-ls/pull/839)) - - Make loading of parent directory after lower level directories work ([#851](https://github.com/hashicorp/terraform-ls/pull/851)) - - Fix corrupted diffs in formatting responses ([#876](https://github.com/hashicorp/terraform-ls/pull/876)) - - Fix `module.calls` command for Registry modules installed by Terraform v1.1+ ([#872](https://github.com/hashicorp/terraform-ls/pull/872)) - -INTERNAL: - - - Add job scheduler benchmarks & document [expectations around performance](https://github.com/hashicorp/terraform-ls/blob/v0.27.0/docs/benchmarks.md) ([#840](https://github.com/hashicorp/terraform-ls/pull/840)) - -## 0.26.0 (17 March 2022) - -ENHANCEMENTS: - - - Introduce go-to-variable from `tfvars` files ([#727](https://github.com/hashicorp/terraform-ls/pull/727)) - - Automatically refresh semantic tokens for more reliable highlighting ([#630](https://github.com/hashicorp/terraform-ls/pull/630)) - - Enhance semantic highlighting of block labels ([#802](https://github.com/hashicorp/terraform-ls/pull/802)) - - Enable completion, hover, go-to-definition/reference etc. for Terraform Registry modules ([#808](https://github.com/hashicorp/terraform-ls/pull/808)) - - Report dependent semantic highlighting modifiers as `defaultLibrary` (instead of `modification`) ([#817](https://github.com/hashicorp/terraform-ls/pull/817)) - - Semantically highlight type declarations in variable `type` ([#827](https://github.com/hashicorp/terraform-ls/pull/827)) - -BUG FIXES: - - - Address race conditions typically surfaced as "out of range" errors, lack of completion/hover/etc. data or data associated with wrong position within the document ([#782](https://github.com/hashicorp/terraform-ls/pull/782)) - - Fix broken validate on save ([#799](https://github.com/hashicorp/terraform-ls/pull/799)) - - Fix encoding of unknown semantic token types ([#815](https://github.com/hashicorp/terraform-ls/pull/815)) - - Fix missing references for some blocks in a separate config file ([#829](https://github.com/hashicorp/terraform-ls/pull/829)) - -INTERNAL: - - - Simplify module source detection in favour of faster CI/compilation times ([#783](https://github.com/hashicorp/terraform-ls/pull/783)) - - Store documents in a memdb-backed table ([#771](https://github.com/hashicorp/terraform-ls/pull/771)) - - Refactor job scheduler to use memdb for jobs ([#782](https://github.com/hashicorp/terraform-ls/pull/782)) - - build(deps): bump github.com/creachadair/jrpc2 from 0.35.2 to 0.37.0 ([#774](https://github.com/hashicorp/terraform-ls/pull/774), [#795](https://github.com/hashicorp/terraform-ls/pull/795), [#809](https://github.com/hashicorp/terraform-ls/pull/809)) - -## 0.25.2 (11 January 2022) - -BUG FIXES: - - - fix: avoid sending empty diagnostics ([#756](https://github.com/hashicorp/terraform-ls/pull/756)) - - fix: avoid code lens updates when disabled ([#757](https://github.com/hashicorp/terraform-ls/pull/757)) - - fix: Catch OS agnostic interrupt signal ([#755](https://github.com/hashicorp/terraform-ls/pull/755)) - - fix: Return correct target selection range for definition/declaration ([#759](https://github.com/hashicorp/terraform-ls/pull/759)) - - telemetry: Only send requests if data has changed ([#758](https://github.com/hashicorp/terraform-ls/pull/758)) - -INTERNAL: - - - Switch to hc-install from tfinstall ([#737](https://github.com/hashicorp/terraform-ls/pull/737)) - -## 0.25.1 (6 January 2022) - -BUG FIXES: - - - Reduce parallelism for background operations to flatten CPU spikes triggered by workspaces with many modules on machines w/ >2 CPUs (which would previously had higher parallelism) ([#752](https://github.com/hashicorp/terraform-ls/pull/752)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.32.0 to 0.35.2 ([#748](https://github.com/hashicorp/terraform-ls/pull/748)) - - build(deps): bump github.com/spf13/afero from 1.6.0 to 1.8.0 ([#747](https://github.com/hashicorp/terraform-ls/pull/747), [#754](https://github.com/hashicorp/terraform-ls/pull/754)) - - build(deps): bump github.com/mitchellh/mapstructure from 1.4.2 to 1.4.3 ([#732](https://github.com/hashicorp/terraform-ls/pull/732)) - - build(deps): bump github.com/hashicorp/hcl/v2 from 2.10.1 to 2.11.1 ([#731](https://github.com/hashicorp/terraform-ls/pull/731)) - -## 0.25.0 (2 December 2021) - -ENHANCEMENTS: - - - Introduce `module.providers` command ([#712](https://github.com/hashicorp/terraform-ls/pull/712)) - - Diagnostics for all known modules/files are now published automatically (as opposed to just open files) ([#714](https://github.com/hashicorp/terraform-ls/pull/714)) - - Introduce go-to-variable from module input name ([#700](https://github.com/hashicorp/terraform-ls/pull/700)) - -NOTES: - - - Diagnostics for non-autoloaded `*.tfvars` are no longer published, see [#715](https://github.com/hashicorp/terraform-ls/issues/715) for more details ([#714](https://github.com/hashicorp/terraform-ls/pull/714)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.30.1 to 0.32.0 ([#713](https://github.com/hashicorp/terraform-ls/pull/713), [#728](https://github.com/hashicorp/terraform-ls/pull/728)) - - Avoid duplicate state entries (by avoiding symlink evaluation) ([#699](https://github.com/hashicorp/terraform-ls/pull/699)) - -## 0.24.0 (10 November 2021) - -BREAKING CHANGES: - - - `source.formatAll.terraform-ls` is renamed to `source.formatAll.terraform` to follow other similar existing actions in the wild ([#680](https://github.com/hashicorp/terraform-ls/pull/680)) - -ENHANCEMENTS: - - - Implement opt-in telemetry (documented in [`docs/telemetry.md`](https://github.com/hashicorp/terraform-ls/blob/v0.24.0/docs/telemetry.md)) ([#681](https://github.com/hashicorp/terraform-ls/pull/681)) - - Provide workspace-wide symbols for variables in `*.tfvars` ([#658](https://github.com/hashicorp/terraform-ls/issues/658)) - - Go-to-definition now highlights just the definition of a block/attribute instead of the whole attribute/block ([#689](https://github.com/hashicorp/terraform-ls/pull/689)) - - Add configuration option allowing to exclude directories from being indexed upon initialization ([#696](https://github.com/hashicorp/terraform-ls/pull/696)) - - Parse `*.tfvars.json` for workspace-wide symbols and diagnostics ([#697](https://github.com/hashicorp/terraform-ls/pull/697)) - -BUG FIXES: - - - The server announces just a single formatting code action, other actions `source`, `source.fixAll` and `source.formatAll` are removed which helps avoid running the same action multiple times and better follows conventions ([#680](https://github.com/hashicorp/terraform-ls/pull/680)) - - Requesting `Only: []` code actions is now no-op ([#680](https://github.com/hashicorp/terraform-ls/pull/680)) - - Fix indexing of references in dependent modules ([#698](https://github.com/hashicorp/terraform-ls/pull/698)) - - Fix workspace folder removal/addition at runtime ([#707](https://github.com/hashicorp/terraform-ls/pull/707)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.28.0 to 0.30.0 ([#683](https://github.com/hashicorp/terraform-ls/pull/683), [#684](https://github.com/hashicorp/terraform-ls/pull/684), [#686](https://github.com/hashicorp/terraform-ls/pull/686)) - -## 0.23.0 (14 October 2021) - -ENHANCEMENTS: - - - Introduce `module.calls` command ([#632](https://github.com/hashicorp/terraform-ls/pull/632)) - - Introduce experimental completion of required fields. You can opt in via [`prefillRequiredFields` option](https://github.com/hashicorp/terraform-ls/blob/v0.23.0/docs/SETTINGS.md#experimentalfeaturesprefillrequiredfields) ([#657](https://github.com/hashicorp/terraform-ls/pull/657)) - - Ignore `.terragrunt-cache` when indexing initialized modules ([#666](https://github.com/hashicorp/terraform-ls/pull/666)) - - Parse `*.tf.json` for references and symbols ([#672](https://github.com/hashicorp/terraform-ls/pull/672)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.25.1 to 0.28.0 ([#649](https://github.com/hashicorp/terraform-ls/pull/649), [#650](https://github.com/hashicorp/terraform-ls/pull/650), [#662](https://github.com/hashicorp/terraform-ls/pull/662), [#668](https://github.com/hashicorp/terraform-ls/pull/668), [#676](https://github.com/hashicorp/terraform-ls/pull/676), [#677](https://github.com/hashicorp/terraform-ls/pull/677)) - - build(deps): bump github.com/hashicorp/terraform-exec from 0.14.0 to 0.15.0 ([#664](https://github.com/hashicorp/terraform-ls/pull/664)) - -## 0.22.0 (16 September 2021) - -ENHANCEMENTS: - - - Support standalone (not autoloaded) `*.tfvars` files ([#621](https://github.com/hashicorp/terraform-ls/pull/621)) - -BUG FIXES: - - - fix: Limit label completion items to 100 (same as limit for completion items in other contexts) ([#628](https://github.com/hashicorp/terraform-ls/pull/628)) - - Recognize references in module block inputs ([#623](https://github.com/hashicorp/terraform-ls/pull/623)) - -INTERNAL: - - - build(deps): bump github.com/mitchellh/mapstructure from 1.4.1 to 1.4.2 ([#641](https://github.com/hashicorp/terraform-ls/pull/641)) - - build(deps): bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.1 ([#629](https://github.com/hashicorp/terraform-ls/pull/629)) - - build(deps): bump github.com/creachadair/jrpc2 from 0.20.0 to 0.25.0 ([#631](https://github.com/hashicorp/terraform-ls/pull/631), [#636](https://github.com/hashicorp/terraform-ls/pull/636), [#638](https://github.com/hashicorp/terraform-ls/pull/638), [#640](https://github.com/hashicorp/terraform-ls/pull/640), [#642](https://github.com/hashicorp/terraform-ls/pull/642)) - -## 0.21.0 (23 August 2021) - -DEPRECATIONS: - - - `-tf-exec` (CLI flag) is deprecated in favour of LSP config option [`terraformExecPath`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformexecpath-string). `-tf-exec` flag will raise warnings in future releases and will be eventually removed. ([#588](https://github.com/hashicorp/terraform-ls/pull/588)) - - `-tf-log-file` (CLI flag) is deprecated in favour of LSP config option [`terraformLogFilePath`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformlogfilepath-string). `-tf-log-file` flag will raise warnings in future releases and will be eventually removed. ([#619](https://github.com/hashicorp/terraform-ls/pull/619)) - - `tf-exec-timeout` (CLI flag) is deprecated in favour of LSP config option [`terraformExecTimeout`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformexectimeout-string). `tf-exec-timeout` flag will raise warnings in future releases and will be eventually removed. ([#619](https://github.com/hashicorp/terraform-ls/pull/619)) - -BUG FIXES: - - - fix: allow multiple variable validation blocks ([#610](https://github.com/hashicorp/terraform-ls/pull/610)) - - fix: avoid crash on missing block label ([#612](https://github.com/hashicorp/terraform-ls/pull/612)) - - fix: avoid crash when `validate` command returns internal error instead of diagnostics ([#588](https://github.com/hashicorp/terraform-ls/pull/588)) - -ENHANCEMENTS: - - - Always validate URI schema ([#602](https://github.com/hashicorp/terraform-ls/pull/602)) - - Introduce [`terraformExecPath`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformexecpath-string) as option within `initializationOptions` ([#588](https://github.com/hashicorp/terraform-ls/pull/588)) - - Introduce [`terraformLogFilePath`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformlogfilepath-string) as option within `initializationOptions` ([#619](https://github.com/hashicorp/terraform-ls/pull/619)) - - Introduce [`terraformExecTimeout`](https://github.com/hashicorp/terraform-ls/blob/v0.21.0/docs/SETTINGS.md#terraformexectimeout-string) as option within `initializationOptions` ([#619](https://github.com/hashicorp/terraform-ls/pull/619)) - - Introduce format on save code action ([#625](https://github.com/hashicorp/terraform-ls/pull/625)) - -INTERNAL: - - - Update LSP structs to gopls' `0.7.0` ([#608](https://github.com/hashicorp/terraform-ls/pull/608)) - - build(deps): bump github.com/creachadair/jrpc2 from 0.19.1 to 0.20.0 ([#614](https://github.com/hashicorp/terraform-ls/pull/614)) - - build(deps): bump github.com/zclconf/go-cty from 1.9.0 to 1.9.1 ([#624](https://github.com/hashicorp/terraform-ls/pull/624)) - -## 0.20.1 (3 August 2021) - -BUG FIXES: - - - fix: recognize references in common nested expressions ([#596](https://github.com/hashicorp/terraform-ls/pull/596)) - - textDocument/publishDiagnostics: Publish any source-less warnings or errors ([#601](https://github.com/hashicorp/terraform-ls/pull/601)) - - fix: avoid publishing stale 'validate' diagnostics ([#603](https://github.com/hashicorp/terraform-ls/pull/603)) - - fix: avoid crash on highlighting unknown tuple element ([#605](https://github.com/hashicorp/terraform-ls/pull/605)) - - fix: recognize list(object) and set(object) attributes as blocks ([#607](https://github.com/hashicorp/terraform-ls/pull/607)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.19.0 to 0.19.1 ([#606](https://github.com/hashicorp/terraform-ls/pull/606)) - -## 0.20.0 (29 July 2021) - -FEATURES: - - - Implement reference count code lens ([#584](https://github.com/hashicorp/terraform-ls/pull/584)) - -ENHANCEMENTS: - - - Add support for module input completion/hover/highlighting ([#551](https://github.com/hashicorp/terraform-ls/pull/551)) - - Add support for module output reference completion/hover/highlighting ([#593](https://github.com/hashicorp/terraform-ls/pull/593)) - -BUG FIXES: - - - fix: recognize references in lists and other complex types ([#594](https://github.com/hashicorp/terraform-ls/pull/594)) - -INTERNAL: - - - build(deps): bump github.com/hashicorp/hcl/v2 from 2.10.0 to 2.10.1 ([#589](https://github.com/hashicorp/terraform-ls/pull/589)) - -## 0.19.1 (20 July 2021) - -BUG FIXES: - - - Fix 'go to references' for resources & data sources ([#587](https://github.com/hashicorp/terraform-ls/pull/587)) - -INTERNAL: - - - build(deps): bump github.com/creachadair/jrpc2 from 0.17.0 to 0.18.0 ([#550](https://github.com/hashicorp/terraform-ls/pull/550)) - -## 0.19.0 (8 July 2021) - -FEATURES: - - - Go to attribute/block from reference ([#569](https://github.com/hashicorp/terraform-ls/pull/569)) - - Go to references from an attribute or a block ([#572](https://github.com/hashicorp/terraform-ls/pull/572), [#580](https://github.com/hashicorp/terraform-ls/pull/580)) - -ENHANCEMENTS: - - - Support multiple folders natively ([#502](https://github.com/hashicorp/terraform-ls/pull/502)) - - Make references scope & type aware ([#582](https://github.com/hashicorp/terraform-ls/pull/582)) - -BUG FIXES: - - - fix: avoid crash on empty file formatting ([#578](https://github.com/hashicorp/terraform-ls/pull/578)) - -## 0.18.3 (2 July 2021) - -BUG FIXES: - - - fix: avoid circular references to list/map/object attributes (which caused high CPU usage on copy) ([#575](https://github.com/hashicorp/terraform-ls/pull/575)) - -## 0.18.2 (1 July 2021) - -ENHANCEMENTS: - - - Provide (less verbose) step-based completion ([#566](https://github.com/hashicorp/terraform-ls/pull/566)) - -BUG FIXES: - - - Mock out code lens support to avoid errors ([#561](https://github.com/hashicorp/terraform-ls/pull/561)) - -## 0.18.1 (17 June 2021) - -ENHANCEMENTS: - - - Support for references to variables and locals ([#553](https://github.com/hashicorp/terraform-ls/pull/553)) - - tfvars: Infer variable types from default values where not explicitly specified ([#554](https://github.com/hashicorp/terraform-ls/pull/554)) - -BUG FIXES: - - - Prevent var names from being completed in label ([#555](https://github.com/hashicorp/terraform-ls/pull/555)) - -## 0.18.0 (10 June 2021) - -FEATURES: - - - Add support for `tfvars` (variable files) ([#540](https://github.com/hashicorp/terraform-ls/pull/540)) - -ENHANCEMENTS: - - - Add support for state backends ([#544](https://github.com/hashicorp/terraform-ls/pull/544)) - - Add support for provisioners ([#542](https://github.com/hashicorp/terraform-ls/pull/542)) - - Support for type declarations (variable `type`) ([#490](https://github.com/hashicorp/terraform-ls/pull/490)) - - Support variable `default` ([#543](https://github.com/hashicorp/terraform-ls/pull/543)) - -## 0.17.1 (26 May 2021) - -BUG FIXES: - - - Reduce CPU usage via custom Copy methods instead reflection ([#513](https://github.com/hashicorp/terraform-ls/pull/513)) - -## 0.17.0 (20 May 2021) - -ENHANCEMENTS: - - - Add support for traversals/references ([#485](https://github.com/hashicorp/terraform-ls/pull/485)) - - Add new `module.callers` (LSP) command & [document all available commands](https://github.com/hashicorp/terraform-ls/blob/41d49b3/docs/commands.md) ([#508](https://github.com/hashicorp/terraform-ls/pull/508)) - -## 0.16.3 (13 May 2021) - -ENHANCEMENTS: - - - Increase request concurrency & make it configurable via `-req-concurrency` flag of `serve` command ([#489](https://github.com/hashicorp/terraform-ls/pull/489)) - -BUG FIXES: - - - Fix request cancellation ([#314](https://github.com/hashicorp/terraform-ls/issues/314)) - -## 0.16.2 (11 May 2021) - -ENHANCEMENTS: - - - Support templated paths for `-cpuprofile` & `-memprofile` flags of `serve` ([#501](https://github.com/hashicorp/terraform-ls/pull/501)) - -BUG FIXES: - - - Avoid presenting stale diagnostics after document changes ([#488](https://github.com/hashicorp/terraform-ls/pull/488)) - -## 0.16.1 (30 April 2021) - -BUG FIXES: - - - Prevent crash for legacy provider lookups where configuration is missing `terraform`>`required_providers` block or `source` arguments for providers and Terraform 0.13+ is used ([#481](https://github.com/hashicorp/terraform-ls/pull/481)) - -## 0.16.0 (29 April 2021) - -**SECURITY:** - -This release is signed with a new GPG key (ID `72D7468F`), unlike all previous releases which were signed with (now revoked) key (ID `348FFC4C`). Old releases were *temporarily* re-signed with the new key, but that key will be removed in coming weeks or months. - -[Read more about the related security event HCSEC-2021-12](https://discuss.hashicorp.com/t/hcsec-2021-12-codecov-security-event-and-hashicorp-gpg-key-exposure/23512/2). - -Users of the [Terraform VS Code extension](https://github.com/hashicorp/vscode-terraform) will need to upgrade to [`2.10.1`](https://github.com/hashicorp/vscode-terraform/blob/v2.10.1/CHANGELOG.md#2101-2021-04-28) before auto-upgrading to this LS version. - - -ENHANCEMENTS: - - - Allow effective utilization of multiple schema sources (local or preloaded) via cache ([#454](https://github.com/hashicorp/terraform-ls/issues/454)) - - _"No schema found ..."_ warning removed, as schema is far more likely to be available now ([#454](https://github.com/hashicorp/terraform-ls/issues/454)) - - _"Alternative root modules found ..."_ warning removed ([#454](https://github.com/hashicorp/terraform-ls/issues/454)) - - Further improve support for Terraform 0.15 ([#425](https://github.com/hashicorp/terraform-ls/issues/425)) - -BUG FIXES: - - - Fix panic caused by partially unknown map keys in configuration ([#447](https://github.com/hashicorp/terraform-ls/issues/447)) - -## 0.15.0 (12 March 2021) - -FEATURES: - - - Add workspace-wide symbol navigation ([#427](https://github.com/hashicorp/terraform-ls/pull/427)) - -ENHANCEMENTS: - - - textDocument/documentSymbol: Support nested symbols ([#420](https://github.com/hashicorp/terraform-ls/pull/420)) - - Add Go version, OS and architecture to `version` command ([#407](https://github.com/hashicorp/terraform-ls/pull/407)) - - Add initial support for expressions ([#411](https://github.com/hashicorp/terraform-ls/pull/411)) - - Reflect 0.15 schema changes ([#436](https://github.com/hashicorp/terraform-ls/pull/436)) - -BUILD: - - - Provide Linux packages ([#421](https://github.com/hashicorp/terraform-ls/pull/421)) - -## 0.14.0 (23 February 2021) - -FEATURES: - - - Add links to documentation (Ctrl+click in supported clients + hover) ([#402](https://github.com/hashicorp/terraform-ls/pull/402)) - -ENHANCEMENTS: - - - Improve messaging when Terraform is not found ([#401](https://github.com/hashicorp/terraform-ls/pull/401)) - -BUG FIXES: - - - watcher: Refresh versions when plugin lockfile changes ([#403](https://github.com/hashicorp/terraform-ls/pull/403)) - -BUILD: - - - Provide darwin/arm64 (Apple Silicon) build ([#350](https://github.com/hashicorp/terraform-ls/pull/350)) - -## 0.13.0 (5 February 2021) - -FEATURES: - - - watcher: Detect `terraform init` from scratch ([#385](https://github.com/hashicorp/terraform-ls/pull/385)) - -ENHANCEMENTS: - - - cmd: Introduce version JSON output ([#386](https://github.com/hashicorp/terraform-ls/pull/386)) - - Utilize CPU better when loading modules ([#391](https://github.com/hashicorp/terraform-ls/pull/391)) - -BUG FIXES: - - - Fix miscalculated semantic tokens ([#390](https://github.com/hashicorp/terraform-ls/pull/390)) - -## 0.12.1 (12 January 2021) - -BUG FIXES: - - - Print help (and version) to stdout ([#296](https://github.com/hashicorp/terraform-ls/pull/296)) - - Fix broken executable `validate` command ([#373](https://github.com/hashicorp/terraform-ls/pull/373)) - -## 0.12.0 (6 January 2021) - -FEATURES: - - - Implement `textDocument/semanticTokens` (semantic highlighting) ([#331](https://github.com/hashicorp/terraform-ls/pull/331)) - - Implement experimental validate on save feature ([#340](https://github.com/hashicorp/terraform-ls/pull/340)) - -ENHANCEMENTS: - - - Report progress for validate command ([#336](https://github.com/hashicorp/terraform-ls/pull/336)) - - Report deprecated completion items as such ([#337](https://github.com/hashicorp/terraform-ls/pull/337)) - - Preloaded schemas now include partner providers in addition to official ones ([#341](https://github.com/hashicorp/terraform-ls/pull/341)) - -NOTES: - - - Only official (legacy) providers will be completed in `provider` block completion. Partner providers currently require corresponding entry in `required_providers` block, read https://github.com/hashicorp/terraform-ls/issues/370 to understand why and how we plan to address this inconvenient behaviour. - - Preloaded schemas are now being generated at release time (as opposed to being committed to the repo). Therefore availability of these schemas is dependent on particular release process [tracked in this repository](https://github.com/hashicorp/terraform-ls/blob/main/.github/workflows/release.yml). This may interest anyone who does not use the official builds from `releases.hashicorp.com` and has its own build process. Plain `go get` still compiles and runs server correctly, however it won't automatically generate and embed the schemas. ([#341](https://github.com/hashicorp/terraform-ls/pull/341)) - -INTERNAL: - - - Use Go `1.15.2` (previously `1.14.9`) ([#348](https://github.com/hashicorp/terraform-ls/pull/348)) - - Provide package for linux/arm64 ([#351](https://github.com/hashicorp/terraform-ls/pull/351)) - -## 0.11.0 (9 December 2020) - -ENHANCEMENTS: - - - Ask for init if current folder is empty root module ([#257](https://github.com/hashicorp/terraform-ls/pull/257)) - - Display provider versions in completion/hover detail ([#329](https://github.com/hashicorp/terraform-ls/pull/329)) - - Expose `terraform.validate` as command for language clients ([#323](https://github.com/hashicorp/terraform-ls/pull/323)) - - Expose `terraform.init` as command for language clients ([#325](https://github.com/hashicorp/terraform-ls/pull/325)) - - Add human readable name to `rootmodules` command API ([#332](https://github.com/hashicorp/terraform-ls/pull/332)) - - Expose server version via LSP ([#318](https://github.com/hashicorp/terraform-ls/pull/318)) - -BUG FIXES: - - - Avoid crashing when no hover data is available for a position ([#320](https://github.com/hashicorp/terraform-ls/pull/320)) - -INTERNAL: - - - Replace `sourcegraph/go-lsp` with gopls' `internal/lsp/protocol` ([#311](https://github.com/hashicorp/terraform-ls/pull/311)) - -## 0.10.0 (19 November 2020) - -FEATURES: - - - Support module wide diagnostics ([#288](https://github.com/hashicorp/terraform-ls/pull/288)) - - Provide documentation on hover ([#294](https://github.com/hashicorp/terraform-ls/pull/294)) - -ENHANCEMENTS: - - - Add support for upcoming Terraform v0.14 ([#289](https://github.com/hashicorp/terraform-ls/pull/289)) - - completion: Prompt picking type of provider/data/resource automatically ([#300](https://github.com/hashicorp/terraform-ls/pull/300)) - - completion/hover: Preload official providers to improve UX for uninitialized modules ([#302](https://github.com/hashicorp/terraform-ls/pull/302)) - -BUG FIXES: - - - textDocument/completion: Fix wrong range computation near EOF ([#298](https://github.com/hashicorp/terraform-ls/pull/298)) - - Avoid ignoring schema for uninitialized module ([#301](https://github.com/hashicorp/terraform-ls/pull/301)) - - fix synchronization issues affecting any clients which support partial updates ([#304](https://github.com/hashicorp/terraform-ls/pull/304)) - - Avoid panic by initing universal schema early ([#307](https://github.com/hashicorp/terraform-ls/pull/307)) - -INTERNAL: - -- Bump jrpc2 (JSON-RPC library) to latest version ([#309](https://github.com/hashicorp/terraform-ls/pull/309)) - -## 0.9.0 (10 November 2020) - -FEATURES: - - - Support for `workspace/executeCommand` with new `rootmodules` inspection command ([#274](https://github.com/hashicorp/terraform-ls/pull/274)) - - Provide version-aware schema for completion of "core" blocks ([#287](https://github.com/hashicorp/terraform-ls/pull/287)) - - `locals`, `module`, `output`, `variable` and `terraform` - - enrichment of `data`, `provider` and `resource` schemas by meta-arguments, such as `count` or `for_each` - -ENHANCEMENTS: - - - Limited completion is available as soon as the server starts and is progressively enhanced as more (core or provider) schema is discovered ([#281](https://github.com/hashicorp/terraform-ls/pull/281)) - - Symbols are available as soon as the server starts ([#281](https://github.com/hashicorp/terraform-ls/pull/281)) - -BUG FIXES: - - - Prevent command collisions for clients such as VS Code with `commandPrefix` init option ([#279](https://github.com/hashicorp/terraform-ls/pull/279)) - -INTERNAL: - - - Internal decoder decoupled into `hashicorp/hcl-lang` ([#281](https://github.com/hashicorp/terraform-ls/pull/281)) - - Schema handling decoupled into `hashicorp/terraform-schema` ([#281](https://github.com/hashicorp/terraform-ls/pull/281)) - -## 0.8.0 (9 October 2020) - -FEATURES: - - - HCL diagnostics support ([#269](https://github.com/hashicorp/terraform-ls/pull/269)) - -BUG FIXES: - - - fix: prevent crash when listing symbols in invalid config ([#273](https://github.com/hashicorp/terraform-ls/pull/273)) - -INTERNAL: - - - Replace most of `internal/terraform/exec` with [`hashicorp/terraform-exec`](https://github.com/hashicorp/terraform-exec) ([#271](https://github.com/hashicorp/terraform-ls/pull/271)) - -## 0.7.0 (2 September 2020) - -FEATURES: - - - Document Symbol support ([#265](https://github.com/hashicorp/terraform-ls/pull/265)) - -## 0.6.1 (18 August 2020) - -BUG FIXES: - - - Reduce logging of module loading ([#259](https://github.com/hashicorp/terraform-ls/pull/259)) - - Update jrpc2 to fix cancelRequest deadlock ([#260](https://github.com/hashicorp/terraform-ls/pull/260)) - -## 0.6.0 (10 August 2020) - -FEATURES: - - - New command: `inspect-module` to help debugging root module discovery issues ([#231](https://github.com/hashicorp/terraform-ls/pull/231)) - -ENHANCEMENTS: - - - Support 0.13 provider identities ([#255](https://github.com/hashicorp/terraform-ls/pull/255)) - - settings: Support relative paths to root modules ([#246](https://github.com/hashicorp/terraform-ls/pull/246)) - - settings: Expand `~` in root module paths ([#247](https://github.com/hashicorp/terraform-ls/pull/247)) - - settings: Add support for `excludeModulePaths` ([#251](https://github.com/hashicorp/terraform-ls/pull/251)) - - handlers/initialize: Skip invalid root module paths ([#248](https://github.com/hashicorp/terraform-ls/pull/248)) - - Cap parallel root module loading (to reduce CPU usage) ([#256](https://github.com/hashicorp/terraform-ls/pull/256)) - -INTERNAL: - - - internal/filesystem: Integrate spf13/afero ([#249](https://github.com/hashicorp/terraform-ls/pull/249)) - - deps: Bump creachadair/jrpc2 to latest (0.10.0) ([#253](https://github.com/hashicorp/terraform-ls/pull/253)) - -## 0.5.4 (22 July 2020) - -BUG FIXES: - - - terraform/schema: Make schema storage version-aware (0.13 compatible) ([#243](https://github.com/hashicorp/terraform-ls/pull/243)) - -INTERNAL: - - - Improve root module discovery error handling ([#244](https://github.com/hashicorp/terraform-ls/pull/244)) - -## 0.5.3 (21 July 2020) - -BUG FIXES: - - - fix: Append EOF instead of newline (prevent CPU spike) ([#239](https://github.com/hashicorp/terraform-ls/pull/239)) - -## 0.5.2 (16 July 2020) - -BUG FIXES: - - - fix: Prevent parsing invalid tokens which would cause CPU spike ([#236](https://github.com/hashicorp/terraform-ls/pull/236)) - -INTERNAL: - - - rootmodule: log errors after loading is finished ([#229](https://github.com/hashicorp/terraform-ls/pull/229)) - -## 0.5.1 (10 July 2020) - -BUG FIXES: - - - Fixes bug which broke schema obtaining due to `-no-color` at unsupported position ([#227](https://github.com/hashicorp/terraform-ls/pull/227)) - -## 0.5.0 (10 July 2020) - -ENHANCEMENTS: - - - Introduce CPU & memory profiling ([#223](https://github.com/hashicorp/terraform-ls/pull/223)) - - Pass `-no-color` to terraform ([#208](https://github.com/hashicorp/terraform-ls/pull/208)) - - settings: Make root modules configurable ([#198](https://github.com/hashicorp/terraform-ls/pull/198)) - -BUG FIXES: - - - terraform/rootmodule: Make walker async by default ([#196](https://github.com/hashicorp/terraform-ls/pull/196)) - - refactor: asynchronous loading of root module parts ([#219](https://github.com/hashicorp/terraform-ls/pull/219)) - - Enable formatting for older Terraform versions (<0.12) ([#219](https://github.com/hashicorp/terraform-ls/pull/219)) - - Gate formatting capability on v0.7.7+ ([#220](https://github.com/hashicorp/terraform-ls/pull/220)) - -## 0.4.1 (3 July 2020) - -BUG FIXES: - - - Make volume comparison case-insensitive on Windows ([#199](https://github.com/hashicorp/terraform-ls/pull/199)) - -## 0.4.0 (25 June 2020) - -FEATURES: - - - Walk hierarchy to add root modules ([#176](https://github.com/hashicorp/terraform-ls/pull/176)) - -ENHANCEMENTS: - - - terraform: Introduce experimental support for 0.13 version ([#149](https://github.com/hashicorp/terraform-ls/pull/149)) - - Treat schema availability as not essential ([#171](https://github.com/hashicorp/terraform-ls/pull/171)) - - Make formatting work regardless of initialization state ([#178](https://github.com/hashicorp/terraform-ls/pull/178)) - -BUG FIXES: - - - fix detection of single file during initialization ([#172](https://github.com/hashicorp/terraform-ls/pull/172)) - -## 0.3.2 (5 June 2020) - -BUG FIXES: - - - fix: os.Environ() returns KEY=val, not just keys (fix of a bug that was introduced in 0.3.1) ([#143](https://github.com/hashicorp/terraform-ls/pull/143)) - -## 0.3.1 (5 June 2020) - -BUG FIXES: - - - terraform/exec: Pass through all environment variables ([#139](https://github.com/hashicorp/terraform-ls/pull/139)) - -## 0.3.0 (4 June 2020) - -FEATURES: - - - textDocument/complete: Complete first level keywords ([#104](https://github.com/hashicorp/terraform-ls/pull/104)) - - Add ability to specify path to Terraform binary ([#109](https://github.com/hashicorp/terraform-ls/pull/109)) - - Make Terraform exec timeout configurable ([#134](https://github.com/hashicorp/terraform-ls/pull/134)) - -ENHANCEMENTS: - - - Improve UX of completion items ([#115](https://github.com/hashicorp/terraform-ls/pull/115)) - - Add support for autocomplete based on a prefix ([#119](https://github.com/hashicorp/terraform-ls/pull/119)) - - textDocument/complete: Use isIncomplete for >100 items ([#132](https://github.com/hashicorp/terraform-ls/pull/132)) - - textDocument/complete: Pass TextEdit instead of static text ([#133](https://github.com/hashicorp/terraform-ls/pull/133)) - -INTERNAL: - - - refactoring(parser): Pass around tokens instead of blocks ([#125](https://github.com/hashicorp/terraform-ls/pull/125)) - - langserver: Make requests sequential ([#120](https://github.com/hashicorp/terraform-ls/pull/120)) - - Support partial updates ([#103](https://github.com/hashicorp/terraform-ls/pull/103)) - - Support simplified building ([#98](https://github.com/hashicorp/terraform-ls/pull/98)) - -## 0.2.1 (19 May 2020) - -BUG FIXES: - - - context: Refactor and fix duplicate key ([#86](https://github.com/hashicorp/terraform-ls/pull/86)) - -INTERNAL: - - - build: Sign archives checksum ([#99](https://github.com/hashicorp/terraform-ls/pull/99)) - - build: Publish artifacts to releases.hashicorp.com ([#102](https://github.com/hashicorp/terraform-ls/pull/102)) - -## 0.2.0 (7 May 2020) - -FEATURES: - - - Add support for formatting (via `terraform fmt`) ([#51](https://github.com/hashicorp/terraform-ls/pull/51)) - - Add support for completing labels ([#58](https://github.com/hashicorp/terraform-ls/pull/58)) - -BUG FIXES: - - - Fix URI parsing for Windows paths ([#73](https://github.com/hashicorp/terraform-ls/pull/73)) - - terraform/exec: Make server work under non-admin users on Windows ([#78](https://github.com/hashicorp/terraform-ls/pull/78)) - -INTERNAL: - - - MacOS and Windows binaries are now signed ([#48](https://github.com/hashicorp/terraform-ls/pull/46)) - - Use Go 1.14.1 (previously `1.13.8`) ([#46](https://github.com/hashicorp/terraform-ls/pull/46)) - -## 0.1.0 (25 March 2020) - -Initial release - -FEATURES: - - - Basic text synchronization with client (`didOpen`, `didClose`, `didChange`) - - Basic block body completion support for attributes and nested blocks - - Support for standard stdio transport - - Support for TCP transport (useful for debugging, or reducing the number of LS instances running) From 649e2a365510c3fe3af5c42d05b3f952db919713 Mon Sep 17 00:00:00 2001 From: Gamunu Balagalla Date: Thu, 12 Sep 2024 14:40:51 +0530 Subject: [PATCH 3/5] feat: use opentofu schema and registry libs Signed-off-by: Gamunu Balagalla --- go.mod | 3 - go.sum | 6 - internal/features/modules/jobs/schema_test.go | 10 +- .../rootmodules/jobs/lockfile_test.go | 10 +- .../features/rootmodules/jobs/schema_test.go | 38 ++--- .../handlers/command/module_calls_test.go | 8 +- .../langserver/handlers/document_link_test.go | 2 +- .../execute_command_module_providers_test.go | 10 +- internal/registry/module.go | 148 ++++++++++-------- internal/registry/provider.go | 109 ++++--------- internal/registry/registry.go | 5 +- internal/schemas/gen/gen.go | 128 ++++----------- .../datadir/plugin_lock_file_test.go | 8 +- 13 files changed, 181 insertions(+), 304 deletions(-) diff --git a/go.mod b/go.mod index 900068cd2..e10743b13 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,6 @@ require ( require ( github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect - github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect @@ -95,8 +94,6 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.4.2 // indirect go.bobheadxi.dev/streamline v1.2.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 go.opentelemetry.io/otel v1.28.0 golang.org/x/crypto v0.25.0 // indirect golang.org/x/mod v0.19.0 // indirect diff --git a/go.sum b/go.sum index 8049b3b1b..96284ad8a 100644 --- a/go.sum +++ b/go.sum @@ -108,8 +108,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= @@ -404,10 +402,6 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0 h1:IVtyPth4Rs5P8wIf0mP2KVKFNTJ4paX9qQ4Hkh5gFdc= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0/go.mod h1:ImRBLMJv177/pwiLZ7tU7HDGNdBv7rS0HQ99eN/zBl8= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= diff --git a/internal/features/modules/jobs/schema_test.go b/internal/features/modules/jobs/schema_test.go index 83bf4075a..45d566ad7 100644 --- a/internal/features/modules/jobs/schema_test.go +++ b/internal/features/modules/jobs/schema_test.go @@ -478,11 +478,11 @@ func TestPreloadEmbeddedSchema_basic(t *testing.T) { dataDir := "data" schemasFS := fstest.MapFS{ dataDir: &fstest.MapFile{Mode: fs.ModeDir}, - dataDir + "/registry.terraform.io": &fstest.MapFile{Mode: fs.ModeDir}, - dataDir + "/registry.terraform.io/hashicorp": &fstest.MapFile{Mode: fs.ModeDir}, - dataDir + "/registry.terraform.io/hashicorp/random": &fstest.MapFile{Mode: fs.ModeDir}, - dataDir + "/registry.terraform.io/hashicorp/random/1.0.0": &fstest.MapFile{Mode: fs.ModeDir}, - dataDir + "/registry.terraform.io/hashicorp/random/1.0.0/schema.json.gz": &fstest.MapFile{ + dataDir + "/registry.opentofu.org": &fstest.MapFile{Mode: fs.ModeDir}, + dataDir + "/registry.opentofu.org/hashicorp": &fstest.MapFile{Mode: fs.ModeDir}, + dataDir + "/registry.opentofu.org/hashicorp/random": &fstest.MapFile{Mode: fs.ModeDir}, + dataDir + "/registry.opentofu.org/hashicorp/random/1.0.0": &fstest.MapFile{Mode: fs.ModeDir}, + dataDir + "/registry.opentofu.org/hashicorp/random/1.0.0/schema.json.gz": &fstest.MapFile{ Data: gzipCompressBytes(t, []byte(randomSchemaJSON)), }, } diff --git a/internal/features/rootmodules/jobs/lockfile_test.go b/internal/features/rootmodules/jobs/lockfile_test.go index 87e3229a8..3c587f9c9 100644 --- a/internal/features/rootmodules/jobs/lockfile_test.go +++ b/internal/features/rootmodules/jobs/lockfile_test.go @@ -30,7 +30,7 @@ func TestParseProviderVersions(t *testing.T) { fs := fstest.MapFS{ modPath: &fstest.MapFile{Mode: fs.ModeDir}, filepath.Join(modPath, ".terraform.lock.hcl"): &fstest.MapFile{ - Data: []byte(`provider "registry.terraform.io/hashicorp/aws" { + Data: []byte(`provider "registry.opentofu.org/hashicorp/aws" { version = "4.23.0" hashes = [ "h1:j6RGCfnoLBpzQVOKUbGyxf4EJtRvQClKplO+WdXL5O0=", @@ -95,7 +95,7 @@ func TestParseProviderVersions_multipleVersions(t *testing.T) { fs := fstest.MapFS{ modPathFirst: &fstest.MapFile{Mode: fs.ModeDir}, filepath.Join(modPathFirst, ".terraform.lock.hcl"): &fstest.MapFile{ - Data: []byte(`provider "registry.terraform.io/hashicorp/aws" { + Data: []byte(`provider "registry.opentofu.org/hashicorp/aws" { version = "4.23.0" hashes = [ "h1:j6RGCfnoLBpzQVOKUbGyxf4EJtRvQClKplO+WdXL5O0=", @@ -135,7 +135,7 @@ func TestParseProviderVersions_multipleVersions(t *testing.T) { modPathSecond: &fstest.MapFile{Mode: fs.ModeDir}, filepath.Join(modPathSecond, ".terraform.lock.hcl"): &fstest.MapFile{ - Data: []byte(`provider "registry.terraform.io/hashicorp/aws" { + Data: []byte(`provider "registry.opentofu.org/hashicorp/aws" { version = "4.25.0" hashes = [ "h1:j6RGCfnoLBpzQVOKUbGyxf4EJtRvQClKplO+WdXL5O0=", @@ -239,7 +239,7 @@ func TestParseProviderVersions_multipleVersions(t *testing.T) { &tfjson.ProviderSchemas{ FormatVersion: "1.0", Schemas: map[string]*tfjson.ProviderSchema{ - "registry.terraform.io/hashicorp/aws": { + "registry.opentofu.org/hashicorp/aws": { ConfigSchema: &tfjson.Schema{ Block: &tfjson.SchemaBlock{ Attributes: map[string]*tfjson.SchemaAttribute{ @@ -268,7 +268,7 @@ func TestParseProviderVersions_multipleVersions(t *testing.T) { &tfjson.ProviderSchemas{ FormatVersion: "1.0", Schemas: map[string]*tfjson.ProviderSchema{ - "registry.terraform.io/hashicorp/aws": { + "registry.opentofu.org/hashicorp/aws": { ConfigSchema: &tfjson.Schema{ Block: &tfjson.SchemaBlock{ Attributes: map[string]*tfjson.SchemaAttribute{ diff --git a/internal/features/rootmodules/jobs/schema_test.go b/internal/features/rootmodules/jobs/schema_test.go index 2f6f5aa45..a798c4fd3 100644 --- a/internal/features/rootmodules/jobs/schema_test.go +++ b/internal/features/rootmodules/jobs/schema_test.go @@ -713,12 +713,9 @@ func TestStateStore_ListSchemas(t *testing.T) { }, Schema: &tfschema.ProviderSchema{ Provider: &schema.BodySchema{ - Detail: "hashicorp/aws-local 0.9.0", - HoverURL: "https://registry.terraform.io/providers/hashicorp/aws-local/0.9.0/docs", - DocsLink: &schema.DocsLink{ - URL: "https://registry.terraform.io/providers/hashicorp/aws-local/0.9.0/docs", - Tooltip: "hashicorp/aws-local Documentation", - }, + Detail: "hashicorp/aws-local 0.9.0", + HoverURL: "", + DocsLink: nil, Attributes: map[string]*schema.AttributeSchema{}, Blocks: map[string]*schema.BlockSchema{}, }, @@ -736,12 +733,9 @@ func TestStateStore_ListSchemas(t *testing.T) { }, Schema: &tfschema.ProviderSchema{ Provider: &schema.BodySchema{ - Detail: "hashicorp/aws-local 1.0.0", - HoverURL: "https://registry.terraform.io/providers/hashicorp/aws-local/1.0.0/docs", - DocsLink: &schema.DocsLink{ - URL: "https://registry.terraform.io/providers/hashicorp/aws-local/1.0.0/docs", - Tooltip: "hashicorp/aws-local Documentation", - }, + Detail: "hashicorp/aws-local 1.0.0", + HoverURL: "", + DocsLink: nil, Attributes: map[string]*schema.AttributeSchema{}, Blocks: map[string]*schema.BlockSchema{}, }, @@ -759,12 +753,9 @@ func TestStateStore_ListSchemas(t *testing.T) { }, Schema: &tfschema.ProviderSchema{ Provider: &schema.BodySchema{ - Detail: "hashicorp/aws-local 1.3.0", - HoverURL: "https://registry.terraform.io/providers/hashicorp/aws-local/1.3.0/docs", - DocsLink: &schema.DocsLink{ - URL: "https://registry.terraform.io/providers/hashicorp/aws-local/1.3.0/docs", - Tooltip: "hashicorp/aws-local Documentation", - }, + Detail: "hashicorp/aws-local 1.3.0", + HoverURL: "", + DocsLink: nil, Attributes: map[string]*schema.AttributeSchema{}, Blocks: map[string]*schema.BlockSchema{}, }, @@ -782,19 +773,16 @@ func TestStateStore_ListSchemas(t *testing.T) { }, Schema: &tfschema.ProviderSchema{ Provider: &schema.BodySchema{ - Detail: "hashicorp/blah 1.0.0", - HoverURL: "https://registry.terraform.io/providers/hashicorp/blah/1.0.0/docs", - DocsLink: &schema.DocsLink{ - URL: "https://registry.terraform.io/providers/hashicorp/blah/1.0.0/docs", - Tooltip: "hashicorp/blah Documentation", - }, + Detail: "hashicorp/blah 1.0.0", + HoverURL: "", + DocsLink: nil, Attributes: map[string]*schema.AttributeSchema{}, Blocks: map[string]*schema.BlockSchema{}, }, }, }, } - if diff := cmp.Diff(expectedSchemas, schemas, cmpOpts); diff != "" { + if diff := cmp.Diff(schemas, expectedSchemas, cmpOpts); diff != "" { t.Fatalf("unexpected schemas: %s", diff) } } diff --git a/internal/langserver/handlers/command/module_calls_test.go b/internal/langserver/handlers/command/module_calls_test.go index 8087726dd..9b9ccb301 100644 --- a/internal/langserver/handlers/command/module_calls_test.go +++ b/internal/langserver/handlers/command/module_calls_test.go @@ -64,7 +64,7 @@ func Test_parseModuleRecords(t *testing.T) { SourceAddr: "terraform-aws-modules/ec2-instance/aws", Version: "2.12.0", SourceType: "tfregistry", - DocsLink: "https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws/latest?utm_content=workspace%2FexecuteCommand%2Fmodule.calls&utm_source=terraform-ls", + DocsLink: "", DependentModules: []moduleCall{}, }, { @@ -72,7 +72,7 @@ func Test_parseModuleRecords(t *testing.T) { SourceAddr: "terraform-aws-modules/eks/aws", Version: "17.20.0", SourceType: "tfregistry", - DocsLink: "https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest?utm_content=workspace%2FexecuteCommand%2Fmodule.calls&utm_source=terraform-ls", + DocsLink: "", DependentModules: []moduleCall{}, }, { @@ -112,7 +112,7 @@ func Test_parseModuleRecords_v1_1(t *testing.T) { Declared: map[string]tfmod.DeclaredModuleCall{ "ec2_instances": { LocalName: "ec2_instances", - SourceAddr: tfaddr.MustParseModuleSource("registry.terraform.io/terraform-aws-modules/ec2-instance/aws"), + SourceAddr: tfaddr.MustParseModuleSource("registry.opentofu.org/terraform-aws-modules/ec2-instance/aws"), Version: version.MustConstraints(version.NewConstraint("2.12.0")), }, }, @@ -123,7 +123,7 @@ func Test_parseModuleRecords_v1_1(t *testing.T) { SourceAddr: "terraform-aws-modules/ec2-instance/aws", Version: "2.12.0", SourceType: "tfregistry", - DocsLink: "https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws/latest?utm_content=workspace%2FexecuteCommand%2Fmodule.calls&utm_source=terraform-ls", + DocsLink: "", DependentModules: []moduleCall{}, }, }, diff --git a/internal/langserver/handlers/document_link_test.go b/internal/langserver/handlers/document_link_test.go index db6ebb8cd..94706a213 100644 --- a/internal/langserver/handlers/document_link_test.go +++ b/internal/langserver/handlers/document_link_test.go @@ -127,7 +127,7 @@ func TestDocumentLink_withValidData(t *testing.T) { "character": 15 } }, - "target": "https://registry.terraform.io/providers/test/test/latest/docs?utm_content=documentLink\u0026utm_source=terraform-ls" + "target": "https://registry.opentofu.org/providers/test/test/latest/docs?utm_content=documentLink\u0026utm_source=terraform-ls" } ] }`) diff --git a/internal/langserver/handlers/execute_command_module_providers_test.go b/internal/langserver/handlers/execute_command_module_providers_test.go index 62f806a74..44bf18611 100644 --- a/internal/langserver/handlers/execute_command_module_providers_test.go +++ b/internal/langserver/handlers/execute_command_module_providers_test.go @@ -169,20 +169,18 @@ func TestLangServer_workspaceExecuteCommand_moduleProviders_basic(t *testing.T) "result": { "v": 0, "provider_requirements": { - "registry.terraform.io/hashicorp/aws": { + "registry.opentofu.org/hashicorp/aws": { "display_name": "hashicorp/aws", "version_constraint":"1.2.3", - "docs_link": "https://registry.terraform.io/providers/hashicorp/aws/latest?utm_content=workspace%2FexecuteCommand%2Fmodule.providers\u0026utm_source=terraform-ls" }, - "registry.terraform.io/hashicorp/google": { + "registry.opentofu.org/hashicorp/google": { "display_name": "hashicorp/google", "version_constraint": "\u003e= 2.0.0", - "docs_link": "https://registry.terraform.io/providers/hashicorp/google/latest?utm_content=workspace%2FexecuteCommand%2Fmodule.providers\u0026utm_source=terraform-ls" } }, "installed_providers":{ - "registry.terraform.io/hashicorp/aws": "1.2.3", - "registry.terraform.io/hashicorp/google": "2.5.5" + "registry.opentofu.org/hashicorp/aws": "1.2.3", + "registry.opentofu.org/hashicorp/google": "2.5.5" } } }`) diff --git a/internal/registry/module.go b/internal/registry/module.go index db6d792d9..a33c1556f 100644 --- a/internal/registry/module.go +++ b/internal/registry/module.go @@ -1,4 +1,4 @@ -// Copyright (c) HashiCorp, Inc. +// Copyright (c) Gamunu Balagalla. // SPDX-License-Identifier: MPL-2.0 package registry @@ -9,76 +9,105 @@ import ( "fmt" "io/ioutil" "net/http" - "net/http/httptrace" "sort" "time" "github.com/hashicorp/go-version" tfaddr "github.com/opentofu/registry-address" - "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/trace" ) -type ModuleResponse struct { - Version string `json:"version"` - PublishedAt time.Time `json:"published_at"` - Root ModuleRoot `json:"root"` +type ClientError struct { + StatusCode int + Body string } -type ModuleRoot struct { - Inputs []Input `json:"inputs"` - Outputs []Output `json:"outputs"` +func (ce ClientError) Error() string { + return fmt.Sprintf("%d: %s", ce.StatusCode, ce.Body) } -type Input struct { - Name string `json:"name"` - Type string `json:"type"` - Description string `json:"description"` - Default string `json:"default"` - Required bool `json:"required"` +type Module struct { + Addr ModuleAddr `json:"addr"` + Description string `json:"description"` + Versions []ModuleVersionDescriptor `json:"versions"` + IsBlocked bool `json:"is_blocked"` + BlockedReason string `json:"blocked_reason"` } -type Output struct { - Name string `json:"name"` - Description string `json:"description"` +type ModuleAddr struct { + Display string `json:"display"` + Namespace string `json:"namespace"` + Name string `json:"name"` + Target string `json:"target"` +} + +type ModuleVersionDescriptor struct { + ID string `json:"id"` + Published time.Time `json:"published"` } -type ModuleVersionsResponse struct { - Modules []ModuleVersionsEntry `json:"modules"` +type ModuleVersion struct { + ID string `json:"id"` + Published time.Time `json:"published"` + Description string `json:"description"` + Downloads int `json:"downloads"` + Version string `json:"version"` } -type ModuleVersionsEntry struct { - Versions []ModuleVersion `json:"versions"` +type ModuleDetails struct { + BaseDetails + Dependencies []ModuleDependency `json:"dependencies"` + Providers []ProviderDependency `json:"providers"` + Resources []Resource `json:"resources"` } -type ModuleVersion struct { - Version string `json:"version"` +type BaseDetails struct { + Readme bool `json:"readme"` + Variables map[string]Variable `json:"variables"` + Outputs map[string]Output `json:"outputs"` + SchemaError string `json:"schema_error"` + EditLink string `json:"edit_link"` } -type ClientError struct { - StatusCode int - Body string +type ModuleDependency struct { + Name string `json:"name"` + VersionConstraint string `json:"version_constraint"` + Source string `json:"source"` } -func (rce ClientError) Error() string { - return fmt.Sprintf("%d: %s", rce.StatusCode, rce.Body) +type ProviderDependency struct { + Alias string `json:"alias"` + Name string `json:"name"` + FullName string `json:"full_name"` + VersionConstraint string `json:"version_constraint"` } -func (c Client) GetModuleData(ctx context.Context, addr tfaddr.Module, cons version.Constraints) (*ModuleResponse, error) { - ctx, span := otel.Tracer(tracerName).Start(ctx, "registry:GetModuleData") - defer span.End() - var response ModuleResponse +type Resource struct { + Address string `json:"address"` + Type string `json:"type"` + Name string `json:"name"` +} +type Variable struct { + Type string `json:"type"` + Default interface{} `json:"default"` + Description string `json:"description"` + Required bool `json:"required"` + Sensitive bool `json:"sensitive"` +} + +type Output struct { + Description string `json:"description"` + Sensitive bool `json:"sensitive"` +} + +func (c Client) GetModuleData(ctx context.Context, addr tfaddr.Module, cons version.Constraints) (*ModuleDetails, error) { v, err := c.GetMatchingModuleVersion(ctx, addr, cons) if err != nil { return nil, err } - ctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx, otelhttptrace.WithoutSubSpans())) - - url := fmt.Sprintf("%s/v1/modules/%s/%s/%s/%s", c.BaseURL, + url := fmt.Sprintf("%s/modules/%s/%s/%s/%s/index.json", + c.BaseURL, addr.Package.Namespace, addr.Package.Name, addr.Package.TargetSystem, @@ -95,15 +124,15 @@ func (c Client) GetModuleData(ctx context.Context, addr tfaddr.Module, cons vers } defer resp.Body.Close() - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { bodyBytes, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } - return nil, ClientError{StatusCode: resp.StatusCode, Body: string(bodyBytes)} } + var response ModuleDetails err = json.NewDecoder(resp.Body).Decode(&response) if err != nil { return nil, err @@ -113,8 +142,6 @@ func (c Client) GetModuleData(ctx context.Context, addr tfaddr.Module, cons vers } func (c Client) GetMatchingModuleVersion(ctx context.Context, addr tfaddr.Module, con version.Constraints) (*version.Version, error) { - ctx, span := otel.Tracer(tracerName).Start(ctx, "registry:GetMatchingModuleVersion") - defer span.End() foundVersions, err := c.GetModuleVersions(ctx, addr) if err != nil { return nil, err @@ -130,16 +157,12 @@ func (c Client) GetMatchingModuleVersion(ctx context.Context, addr tfaddr.Module } func (c Client) GetModuleVersions(ctx context.Context, addr tfaddr.Module) (version.Collection, error) { - ctx, span := otel.Tracer(tracerName).Start(ctx, "registry:GetModuleVersions") - defer span.End() - - url := fmt.Sprintf("%s/v1/modules/%s/%s/%s/versions", c.BaseURL, + url := fmt.Sprintf("%s/modules/%s/%s/%s/index.json", + c.BaseURL, addr.Package.Namespace, addr.Package.Name, addr.Package.TargetSystem) - ctx = httptrace.WithClientTrace(ctx, otelhttptrace.NewClientTrace(ctx, otelhttptrace.WithoutSubSpans())) - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) if err != nil { return nil, err @@ -151,38 +174,27 @@ func (c Client) GetModuleVersions(ctx context.Context, addr tfaddr.Module) (vers } defer resp.Body.Close() - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { bodyBytes, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } - return nil, ClientError{StatusCode: resp.StatusCode, Body: string(bodyBytes)} } - _, decodeSpan := otel.Tracer(tracerName).Start(ctx, "registry:GetModuleVersions:decodeJson") - var response ModuleVersionsResponse - err = json.NewDecoder(resp.Body).Decode(&response) + var module Module + err = json.NewDecoder(resp.Body).Decode(&module) if err != nil { return nil, err } - decodeSpan.End() var foundVersions version.Collection - for _, module := range response.Modules { - for _, entry := range module.Versions { - ver, err := version.NewVersion(entry.Version) - if err == nil { - foundVersions = append(foundVersions, ver) - } + for _, ver := range module.Versions { + v, err := version.NewVersion(ver.ID) + if err == nil { + foundVersions = append(foundVersions, v) } } - span.AddEvent("registry:foundModuleVersions", - trace.WithAttributes(attribute.KeyValue{ - Key: attribute.Key("moduleVersionCount"), - Value: attribute.IntValue(len(foundVersions)), - })) - sort.Sort(sort.Reverse(foundVersions)) return foundVersions, nil diff --git a/internal/registry/provider.go b/internal/registry/provider.go index 545755081..1880e893d 100644 --- a/internal/registry/provider.go +++ b/internal/registry/provider.go @@ -1,4 +1,4 @@ -// Copyright (c) HashiCorp, Inc. +// Copyright (c) Gamunu Balagalla. // SPDX-License-Identifier: MPL-2.0 package registry @@ -8,108 +8,61 @@ import ( "fmt" "io/ioutil" "net/http" + "time" ) -type pagination struct { - NextPage int `json:"next-page"` +type ProviderList struct { + Providers []Provider `json:"providers"` } -type meta struct { - Pagination pagination `json:"pagination"` -} - -type registryResponse struct { - Data []Provider `json:"data"` - Meta meta `json:"meta"` +type Provider struct { + Addr ProviderAddr `json:"addr"` + BlockedReason string `json:"blocked_reason"` + CanonicalAddr ProviderAddr `json:"canonical_addr"` + Description string `json:"description"` + ForkCount int `json:"fork_count"` + ForkOf *ProviderAddr `json:"fork_of,omitempty"` + ForkOfLink string `json:"fork_of_link"` + IsBlocked bool `json:"is_blocked"` + Popularity int `json:"popularity"` + ReverseAliases []ProviderAddr `json:"reverse_aliases"` + UpstreamForkCount int `json:"upstream_fork_count"` + UpstreamPopularity int `json:"upstream_popularity"` + Versions []ProviderVersion `json:"versions"` } -type ProviderAttributes struct { +type ProviderAddr struct { + Display string `json:"display"` Name string `json:"name"` Namespace string `json:"namespace"` } -type Provider struct { - ID string `json:"id"` - Attributes ProviderAttributes `json:"attributes"` +type ProviderVersion struct { + ID string `json:"id"` + Published time.Time `json:"published"` } -func (c Client) ListProviders(tier string) ([]Provider, error) { - var providers []Provider - page := 1 - for page > 0 { - url := fmt.Sprintf("%s/v2/providers?page[size]=%d&filter[tier]=%s&page[number]=%d", - c.BaseURL, c.ProviderPageSize, tier, page) - resp, err := http.Get(url) - if err != nil { - return nil, err - } - - if resp.StatusCode != 200 { - bodyBytes, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - defer resp.Body.Close() - return nil, fmt.Errorf("unexpected response: %s: %s", resp.Status, string(bodyBytes)) - } - - var response registryResponse - err = json.NewDecoder(resp.Body).Decode(&response) - if err != nil { - return nil, fmt.Errorf("unable to decode response: %w", err) - } - providers = append(providers, response.Data...) - page = response.Meta.Pagination.NextPage - } - return providers, nil -} - -type ProviderVersionResponse struct { - Data ProviderVersionData `json:"data"` - Included []Included `json:"included"` -} - -type Included struct { - Type string `json:"type"` - Attributes IncludedAttributes `json:"attributes"` -} - -type IncludedAttributes struct { - Arch string `json:"arch"` - Os string `json:"os"` -} - -type ProviderVersionData struct { - Attributes ProviderVersionAttributes `json:"attributes"` -} - -type ProviderVersionAttributes struct { - Version string `json:"version"` -} - -func (c Client) GetLatestProviderVersion(id string) (*ProviderVersionResponse, error) { - url := fmt.Sprintf("%s/v2/providers/%s/provider-versions/latest?include=provider-platforms", - c.BaseURL, id) +func (c Client) ListProviders() ([]Provider, error) { + url := fmt.Sprintf("%s/providers/index.json", c.BaseURL) resp, err := http.Get(url) if err != nil { return nil, err } + defer resp.Body.Close() - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { bodyBytes, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } - defer resp.Body.Close() - - return nil, fmt.Errorf("unexpected response %s: %s", resp.Status, string(bodyBytes)) + return nil, fmt.Errorf("unexpected response: %s: %s", resp.Status, string(bodyBytes)) } - var response ProviderVersionResponse + var response ProviderList err = json.NewDecoder(resp.Body).Decode(&response) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to decode response: %w", err) } - return &response, nil + return response.Providers, nil } diff --git a/internal/registry/registry.go b/internal/registry/registry.go index cdd38f104..8cfc52df3 100644 --- a/internal/registry/registry.go +++ b/internal/registry/registry.go @@ -8,13 +8,11 @@ import ( "time" "github.com/hashicorp/go-cleanhttp" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" ) const ( - defaultBaseURL = "https://registry.terraform.io" + defaultBaseURL = "https://api.opentofu.org" defaultTimeout = 5 * time.Second - tracerName = "github.com/hashicorp/terraform-ls/internal/registry" ) type Client struct { @@ -27,7 +25,6 @@ type Client struct { func NewClient() Client { client := cleanhttp.DefaultClient() client.Timeout = defaultTimeout - client.Transport = otelhttp.NewTransport(client.Transport) return Client{ BaseURL: defaultBaseURL, diff --git a/internal/schemas/gen/gen.go b/internal/schemas/gen/gen.go index 6c11c2f2c..51f7eb542 100644 --- a/internal/schemas/gen/gen.go +++ b/internal/schemas/gen/gen.go @@ -1,3 +1,5 @@ +// Copyright (c) Gamunu Balagalla. +// SPDX-License-Identifier: MPL-2.0 // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 @@ -16,7 +18,6 @@ import ( "log" "os" "path/filepath" - "runtime" "strings" "sync" "syscall" @@ -24,10 +25,6 @@ import ( "time" "github.com/hashicorp/go-version" - hcinstall "github.com/hashicorp/hc-install" - "github.com/hashicorp/hc-install/product" - "github.com/hashicorp/hc-install/releases" - "github.com/hashicorp/hc-install/src" "github.com/hashicorp/terraform-exec/tfexec" tfjson "github.com/hashicorp/terraform-json" lsctx "github.com/hashicorp/terraform-ls/internal/context" @@ -38,8 +35,8 @@ import ( var terraformVersion = version.MustConstraints(version.NewConstraint("~> 1.0")) type Provider struct { - ID string - Addr tfaddr.Provider + Addr tfaddr.Provider + Version string } func main() { @@ -61,71 +58,42 @@ func gen() error { providers := make([]Provider, 0) providers = append(providers, Provider{ - ID: "0", - Addr: tfaddr.NewProvider(tfaddr.BuiltInProviderHost, tfaddr.BuiltInProviderNamespace, "terraform"), + Addr: tfaddr.NewProvider(tfaddr.BuiltInProviderHost, tfaddr.BuiltInProviderNamespace, "opentofu"), }) - // obtain all official & partner providers from the Registry + // obtain all providers from the OpenTofu Registry client := registry.NewClient() - log.Println("fetching official providers from registry") - officialProviders, err := client.ListProviders("official") + log.Println("fetching providers from registry") + registryProviders, err := client.ListProviders() if err != nil { return err } - log.Printf("fetched official providers: %d", len(officialProviders)) - for _, p := range officialProviders { - if p.Attributes.Namespace == "hashicorp" && p.Attributes.Name == "terraform" { - // skip the old terraform provider as this is now built-in + log.Printf("fetched providers: %d", len(registryProviders)) + for _, p := range registryProviders { + if len(p.Versions) == 0 { + log.Printf("skipping %s/%s: no versions available", p.Addr.Namespace, p.Addr.Name) continue } + latestVersion := p.Versions[0].ID // Use the first version as it's the latest providers = append(providers, Provider{ - ID: p.ID, - Addr: tfaddr.NewProvider( - tfaddr.DefaultProviderRegistryHost, - p.Attributes.Namespace, - p.Attributes.Name, - ), - }) - } - log.Println("fetching verified partner providers from registry") - partnerProviders, err := client.ListProviders("partner") - if err != nil { - return err - } - log.Printf("fetched partner providers: %d", len(partnerProviders)) - for _, p := range partnerProviders { - providers = append(providers, Provider{ - ID: p.ID, Addr: tfaddr.NewProvider( tfaddr.DefaultProviderRegistryHost, - p.Attributes.Namespace, - p.Attributes.Name, + p.Addr.Namespace, + p.Addr.Name, ), + Version: latestVersion, }) } - // find or install Terraform - log.Println("ensuring terraform is installed") + // find or install opentofu + log.Println("ensuring tofu is installed") installDir, err := ioutil.TempDir("", "hcinstall") if err != nil { return err } defer os.RemoveAll(installDir) - i := hcinstall.NewInstaller() - execPath, err := i.Ensure(ctx, []src.Source{ - &releases.LatestVersion{ - Product: product.Terraform, - InstallDir: installDir, - Constraints: terraformVersion, - }, - }) - if err != nil { - return err - } - defer i.Remove(ctx) - // log version - tf, err := tfexec.NewTerraform(installDir, execPath) + tf, err := tfexec.NewTerraform(installDir, "tofu") if err != nil { return err } @@ -133,7 +101,7 @@ func gen() error { if err != nil { return err } - log.Printf("using Terraform %s (%s)", coreVersion, execPath) + log.Printf("using tofu %s (%s)", coreVersion, "tofu") workspacePath, err := filepath.Abs("gen-workspace") if err != nil { @@ -172,14 +140,14 @@ func gen() error { if err != nil { return err } - log.Printf("Terraform plugin cache will be stored at %s", cacheDirPath) + log.Printf("Tofu plugin cache will be stored at %s", cacheDirPath) // install each provider and obtain schema for it providerChan := make(chan Inputs) go func() { for _, p := range providers { providerChan <- Inputs{ - TerraformExecPath: execPath, + TerraformExecPath: "tofu", WorkspacePath: workspacePath, DataDirPath: dataDirPath, CacheDirPath: cacheDirPath, @@ -191,7 +159,7 @@ func gen() error { }() var workerWg sync.WaitGroup - workerCount := runtime.NumCPU() + workerCount := 1 //runtime.NumCPU() log.Printf("worker count: %d", workerCount) workerWg.Add(workerCount) for i := 1; i <= workerCount; i++ { @@ -205,7 +173,7 @@ func gen() error { continue } - log.Printf("%s: obtained schema for %s (%db raw / %db compressed); terraform init: %s", + log.Printf("%s: obtained schema for %s (%db raw / %db compressed); tofu init: %s", input.Provider.Addr.ForDisplay(), details.Version, details.RawSize, details.CompressedSize, details.InitElapsedTime) } @@ -232,23 +200,16 @@ type Outputs struct { InitElapsedTime time.Duration } +// In the schemaForProvider function, replace the GetLatestProviderVersion call: func schemaForProvider(ctx context.Context, client registry.Client, input Inputs) (*Outputs, error) { var pVersion *version.Version if input.Provider.Addr.IsBuiltIn() { pVersion = input.CoreVersion } else { - resp, err := client.GetLatestProviderVersion(input.Provider.ID) - if err != nil { - return nil, fmt.Errorf("failed to get latest version: %w", err) - } - - pVersion, err = version.NewVersion(resp.Data.Attributes.Version) + var err error + pVersion, err = version.NewVersion(input.Provider.Version) if err != nil { - return nil, fmt.Errorf("invalid version %q: %w", resp.Data.Attributes.Version, err) - } - - if !providerVersionSupportsOsAndArch(resp.Included, runtime.GOOS, runtime.GOARCH) { - return nil, fmt.Errorf("version %s does not support %s/%s", pVersion, runtime.GOOS, runtime.GOARCH) + return nil, fmt.Errorf("invalid version %q: %w", input.Provider.Version, err) } } @@ -300,7 +261,7 @@ func schemaForProvider(ctx context.Context, client registry.Client, input Inputs err = tmpl.Execute(configFile, templateData{ TerraformVersion: terraformVersion.String(), - LocalName: "provider" + input.Provider.ID, + LocalName: "provider", Source: input.Provider.Addr.ForDisplay(), Version: pVersion.String(), }) @@ -314,25 +275,14 @@ func schemaForProvider(ctx context.Context, client registry.Client, input Inputs return nil, err } - // See https://github.com/hashicorp/terraform-exec/issues/337 - // Terraform would refuse to init any provider otherwise - // and some providers refuse to give schemas or break - // the gRPC protocol for some mysterious reason - env := make(map[string]string, 0) + env := make(map[string]string) for _, rawKeyPair := range os.Environ() { - parts := strings.Split(rawKeyPair, "=") - if parts[0] == "" { - // For unknown reasons on Windows there can be some odd variables - // such as "=::=::\\", "=C:=C:\\path" or "=ExitCode=00000000" - // which we ignore here + parts := strings.SplitN(rawKeyPair, "=", 2) + if len(parts) != 2 || parts[0] == "" { continue } - env[parts[0]] = os.Getenv(parts[0]) + env[parts[0]] = parts[1] } - // This is to help keep paths short, esp. on Windows - // (260 characters by default) - // See https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation - // and also to avoid embedding the provider binaries env["TF_PLUGIN_CACHE_DIR"] = input.CacheDirPath tf.SetEnv(env) @@ -358,7 +308,6 @@ func schemaForProvider(ctx context.Context, client registry.Client, input Inputs } } - // TODO upstream change to have tfexec write to file directly instead of unmarshal/remarshal ps, err := retryProviderSchema(ctx, tf, input.Provider.Addr.ForDisplay(), 0) if err != nil { return nil, err @@ -472,14 +421,3 @@ func initErrorIsRetryable(err error) (string, bool) { } return "", false } - -func providerVersionSupportsOsAndArch(includes []registry.Included, os, arch string) bool { - for _, inc := range includes { - if inc.Type == "provider-platforms" && - inc.Attributes.Os == os && - inc.Attributes.Arch == arch { - return true - } - } - return false -} diff --git a/internal/terraform/datadir/plugin_lock_file_test.go b/internal/terraform/datadir/plugin_lock_file_test.go index 5c84502d2..bdf244a9b 100644 --- a/internal/terraform/datadir/plugin_lock_file_test.go +++ b/internal/terraform/datadir/plugin_lock_file_test.go @@ -47,11 +47,11 @@ func TestParsePluginVersions_basic013(t *testing.T) { filepath.Join("foo-module", ".terraform", "plugins"): &fstest.MapFile{Mode: fs.ModeDir}, filepath.Join("foo-module", ".terraform", "plugins", "selections.json"): &fstest.MapFile{ Data: []byte(`{ - "registry.terraform.io/hashicorp/aws": { + "registry.opentofu.org/hashicorp/aws": { "hash": "h1:j6RGCfnoLBpzQVOKUbGyxf4EJtRvQClKplO+WdXL5O0=", "version": "4.23.0" }, - "registry.terraform.io/hashicorp/google": { + "registry.opentofu.org/hashicorp/google": { "hash": "h1:vZdocusWLMUSeRLI3W3dd3bgKYovGntsaHiXFIfM484=", "version": "4.29.0" } @@ -79,7 +79,7 @@ func TestParsePluginVersions_basic014(t *testing.T) { Data: []byte(`# This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. -provider "registry.terraform.io/hashicorp/aws" { +provider "registry.opentofu.org/hashicorp/aws" { version = "4.23.0" hashes = [ "h1:j6RGCfnoLBpzQVOKUbGyxf4EJtRvQClKplO+WdXL5O0=", @@ -98,7 +98,7 @@ provider "registry.terraform.io/hashicorp/aws" { ] } -provider "registry.terraform.io/hashicorp/google" { +provider "registry.opentofu.org/hashicorp/google" { version = "4.29.0" hashes = [ "h1:vZdocusWLMUSeRLI3W3dd3bgKYovGntsaHiXFIfM484=", From 0c940c3b57315d5b1adac897d225382b9fe5e683 Mon Sep 17 00:00:00 2001 From: Gamunu Balagalla Date: Thu, 12 Sep 2024 14:48:43 +0530 Subject: [PATCH 4/5] fix: install tofu in the pipelie Signed-off-by: Gamunu Balagalla --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 085590f3e..59d407a8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,8 @@ env: jobs: generate-provider-schemas: runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -16,6 +18,11 @@ jobs: uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 with: go-version-file: .go-version + - name: Install OpenTofu + uses: opentofu/setup-opentofu@v1 + with: + tofu_wrapper: false + tofu_version: 1.8.0 - name: Generate provider schemas run: | go generate ./internal/schemas From f0b2b3420cd381f39c71a182c44a3ae57c93ceeb Mon Sep 17 00:00:00 2001 From: Gamunu Balagalla Date: Mon, 16 Sep 2024 13:03:21 +0530 Subject: [PATCH 5/5] refactor: update tests and refactor code Signed-off-by: Gamunu Balagalla --- .../modules/hooks/module_version_test.go | 57 ++- internal/features/modules/jobs/schema.go | 57 +-- internal/registry/module.go | 68 +-- .../registry/module_mock_responses_test.go | 439 ++++++++---------- internal/registry/module_test.go | 271 +++++++---- internal/registry/provider_test.go | 269 +++-------- 6 files changed, 509 insertions(+), 652 deletions(-) diff --git a/internal/features/modules/hooks/module_version_test.go b/internal/features/modules/hooks/module_version_test.go index f2265430e..5aaa5ef1c 100644 --- a/internal/features/modules/hooks/module_version_test.go +++ b/internal/features/modules/hooks/module_version_test.go @@ -23,23 +23,29 @@ import ( ) var moduleVersionsMockResponse = `{ - "modules": [ - { - "source": "terraform-aws-modules/vpc/aws", - "versions": [ - { - "version": "0.0.1" - }, - { - "version": "2.0.24" - }, - { - "version": "1.33.7" - } - ] - } - ] - }` + "addr": { + "display": "azure/aks/azurerm", + "namespace": "azure", + "name": "aks", + "target": "azurerm" + }, + "description": "Terraform Module for deploying an AKS cluster", + "versions": [ + { + "id": "v9.1.0", + "published": "2024-07-04T07:12:29+01:00" + }, + { + "id": "v9.0.0", + "published": "2024-06-07T02:31:28+01:00" + }, + { + "id": "v8.0.0", + "published": "2024-03-05T07:33:07Z" + } + ], + "is_blocked": false +}` func TestHooks_RegistryModuleVersions(t *testing.T) { ctx := context.Background() @@ -67,7 +73,7 @@ func TestHooks_RegistryModuleVersions(t *testing.T) { regClient := registry.NewClient() srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI == "/v1/modules/terraform-aws-modules/vpc/aws/versions" { + if r.RequestURI == "/modules/azure/aks/azurerm/index.json" { w.Write([]byte(moduleVersionsMockResponse)) return } @@ -90,7 +96,7 @@ func TestHooks_RegistryModuleVersions(t *testing.T) { ModuleCalls: map[string]tfmod.DeclaredModuleCall{ "vpc": { LocalName: "vpc", - SourceAddr: tfaddr.MustParseModuleSource("registry.terraform.io/terraform-aws-modules/vpc/aws"), + SourceAddr: tfaddr.MustParseModuleSource("registry.opentofu.org/azure/aks/azurerm"), RangePtr: &hcl.Range{ Filename: "main.tf", Start: hcl.Pos{Line: 1, Column: 1, Byte: 1}, @@ -106,26 +112,27 @@ func TestHooks_RegistryModuleVersions(t *testing.T) { expectedCandidates := []decoder.Candidate{ { - Label: `"2.0.24"`, + Label: `"9.1.0"`, Kind: lang.StringCandidateKind, - RawInsertText: `"2.0.24"`, + RawInsertText: `"9.1.0"`, SortText: " 0", }, { - Label: `"1.33.7"`, + Label: `"9.0.0"`, Kind: lang.StringCandidateKind, - RawInsertText: `"1.33.7"`, + RawInsertText: `"9.0.0"`, SortText: " 1", }, { - Label: `"0.0.1"`, + Label: `"8.0.0"`, Kind: lang.StringCandidateKind, - RawInsertText: `"0.0.1"`, + RawInsertText: `"8.0.0"`, SortText: " 2", }, } candidates, _ := h.RegistryModuleVersions(ctx, cty.StringVal("")) + fmt.Print(candidates) if diff := cmp.Diff(expectedCandidates, candidates); diff != "" { t.Fatalf("mismatched candidates: %s", diff) } diff --git a/internal/features/modules/jobs/schema.go b/internal/features/modules/jobs/schema.go index 09149593c..6eae908c0 100644 --- a/internal/features/modules/jobs/schema.go +++ b/internal/features/modules/jobs/schema.go @@ -250,15 +250,9 @@ func GetModuleDataFromRegistry(ctx context.Context, regClient registry.Client, m continue } - inputs := make([]tfregistry.Input, len(metaData.Root.Inputs)) - for i, input := range metaData.Root.Inputs { - isRequired := isRegistryModuleInputRequired(metaData.PublishedAt, input) - inputs[i] = tfregistry.Input{ - Name: input.Name, - Description: lang.Markdown(input.Description), - Required: isRequired, - } - + inputs := make([]tfregistry.Input, 0, len(metaData.Inputs)) + for name, input := range metaData.Inputs { + isRequired := input.Required inputType := cty.DynamicPseudoType if input.Type != "" { // Registry API unfortunately doesn't marshal types using @@ -270,27 +264,34 @@ func GetModuleDataFromRegistry(ctx context.Context, regClient registry.Client, m inputType = typ } } - inputs[i].Type = inputType + newInput := tfregistry.Input{ + Name: name, + Description: lang.Markdown(input.Description), + Required: isRequired, + Type: inputType, + } - if input.Default != "" { + if input.Default != nil { // Registry API unfortunately doesn't marshal values using // cty marshalers, making it lossy, so we just try to decode // on best-effort basis. - val, err := ctyjson.Unmarshal([]byte(input.Default), inputType) + val, err := ctyjson.Unmarshal([]byte(fmt.Sprintf("%v", input.Default)), inputType) if err == nil { - inputs[i].Default = val + newInput.Default = val } } + inputs = append(inputs, newInput) } - outputs := make([]tfregistry.Output, len(metaData.Root.Outputs)) - for i, output := range metaData.Root.Outputs { - outputs[i] = tfregistry.Output{ - Name: output.Name, + + outputs := make([]tfregistry.Output, 0, len(metaData.Outputs)) + for name, output := range metaData.Outputs { + outputs = append(outputs, tfregistry.Output{ + Name: name, Description: lang.Markdown(output.Description), - } + }) } - modVersion, err := version.NewVersion(metaData.Version) + modVersion, err := version.NewVersion(metaData.ID) if err != nil { errs = multierror.Append(errs, err) continue @@ -313,21 +314,3 @@ func GetModuleDataFromRegistry(ctx context.Context, regClient registry.Client, m return errs.ErrorOrNil() } - -// isRegistryModuleInputRequired checks whether the module input is required. -// It reflects the fact that modules ingested into the Registry -// may have used `default = null` (implying optional variable) which -// the Registry wasn't able to recognise until ~ 19th August 2022. -func isRegistryModuleInputRequired(publishTime time.Time, input registry.Input) bool { - fixTime := time.Date(2022, time.August, 20, 0, 0, 0, 0, time.UTC) - // Modules published after the date have "nullable" inputs - // (default = null) ingested as Required=false and Default="null". - // - // The same inputs ingested prior to the date make it impossible - // to distinguish variable with `default = null` and missing default. - if input.Required && input.Default == "" && publishTime.Before(fixTime) { - // To avoid false diagnostics, we safely assume the input is optional - return false - } - return input.Required -} diff --git a/internal/registry/module.go b/internal/registry/module.go index a33c1556f..3fb37eef0 100644 --- a/internal/registry/module.go +++ b/internal/registry/module.go @@ -45,68 +45,74 @@ type ModuleVersionDescriptor struct { Published time.Time `json:"published"` } -type ModuleVersion struct { - ID string `json:"id"` - Published time.Time `json:"published"` - Description string `json:"description"` - Downloads int `json:"downloads"` - Version string `json:"version"` -} - type ModuleDetails struct { - BaseDetails - Dependencies []ModuleDependency `json:"dependencies"` + ID string `json:"id"` + Published time.Time `json:"published"` + Readme bool `json:"readme"` + Inputs map[string]Variable `json:"variables"` + Outputs map[string]Output `json:"outputs"` Providers []ProviderDependency `json:"providers"` + Dependencies []ModuleDependency `json:"dependencies"` + Submodules map[string]Submodule `json:"submodules"` Resources []Resource `json:"resources"` } -type BaseDetails struct { - Readme bool `json:"readme"` - Variables map[string]Variable `json:"variables"` - Outputs map[string]Output `json:"outputs"` - SchemaError string `json:"schema_error"` - EditLink string `json:"edit_link"` +type Variable struct { + Type string `json:"type"` + Default interface{} `json:"default"` + Description string `json:"description"` + Required bool `json:"required"` + Sensitive bool `json:"sensitive"` } -type ModuleDependency struct { - Name string `json:"name"` - VersionConstraint string `json:"version_constraint"` - Source string `json:"source"` +type Output struct { + Description string `json:"description"` + Sensitive bool `json:"sensitive"` } type ProviderDependency struct { - Alias string `json:"alias"` Name string `json:"name"` FullName string `json:"full_name"` VersionConstraint string `json:"version_constraint"` } +type ModuleDependency struct { + Name string `json:"name"` + VersionConstraint string `json:"version_constraint"` + Source string `json:"source"` +} + type Resource struct { Address string `json:"address"` Type string `json:"type"` Name string `json:"name"` } -type Variable struct { - Type string `json:"type"` - Default interface{} `json:"default"` - Description string `json:"description"` - Required bool `json:"required"` - Sensitive bool `json:"sensitive"` +type Submodule struct { + ModuleDetails } -type Output struct { - Description string `json:"description"` - Sensitive bool `json:"sensitive"` +type Example struct { + ModuleDetails +} + +type License struct { + SPDX string `json:"spdx"` + Confidence float64 `json:"confidence"` + IsCompatible bool `json:"is_compatible"` + File string `json:"file"` + Link string `json:"link"` } +type LicenseList []License + func (c Client) GetModuleData(ctx context.Context, addr tfaddr.Module, cons version.Constraints) (*ModuleDetails, error) { v, err := c.GetMatchingModuleVersion(ctx, addr, cons) if err != nil { return nil, err } - url := fmt.Sprintf("%s/modules/%s/%s/%s/%s/index.json", + url := fmt.Sprintf("%s/modules/%s/%s/%s/v%s/index.json", c.BaseURL, addr.Package.Namespace, addr.Package.Name, diff --git a/internal/registry/module_mock_responses_test.go b/internal/registry/module_mock_responses_test.go index ddd8986a7..85ca93e8a 100644 --- a/internal/registry/module_mock_responses_test.go +++ b/internal/registry/module_mock_responses_test.go @@ -1,272 +1,207 @@ -// Copyright (c) HashiCorp, Inc. +// Copyright (c) Gamunu Balagalla. // SPDX-License-Identifier: MPL-2.0 package registry -// moduleVersionsMockResponse represents response from https://registry.terraform.io/v1/modules/puppetlabs/deployment/ec/versions var moduleVersionsMockResponse = `{ - "modules": [ + "id": "v0.8.1", + "published": "2024-08-05T17:16:42+01:00", + "readme": true, + "edit_link": "https://github.com/azure/terraform-azurerm-alz/blob/v0.8.1/README.md", + "variables": { + "architecture_name": { + "type": "string", + "default": null, + "description": "The name of the architecture to create. This needs to be*.alz_architecture_definition.[json|yaml|yml] files.\n", + "sensitive": false, + "required": true + }, + "location": { + "type": "string", + "default": null, + "description": "The default location for resources in this management group. Used for policy managed identities.\n", + "sensitive": false, + "required": true + } + }, + "outputs": { + "management_group_resource_ids": { + "sensitive": false, + "description": "A map of management group names to their resource ids." + }, + "policy_assignment_resource_ids": { + "sensitive": false, + "description": "A map of policy assignment names to their resource ids." + } + }, + "schema_error": "", + "providers": [], + "dependencies": [ { - "source": "puppetlabs/deployment/ec", - "versions": [ - { - "version": "0.0.5", - "root": { - "providers": [ - { - "name": "ec", - "namespace": "", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "dependencies": [] - }, - "submodules": [] - }, - { - "version": "0.0.6", - "root": { - "providers": [ - { - "name": "ec", - "namespace": "", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "dependencies": [] - }, - "submodules": [] - }, - { - "version": "0.0.8", - "root": { - "providers": [ - { - "name": "ec", - "namespace": "", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "dependencies": [] - }, - "submodules": [] - }, - { - "version": "0.0.2", - "root": { - "providers": [ - { - "name": "ec", - "namespace": "", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "dependencies": [] - }, - "submodules": [] - }, - { - "version": "0.0.1", - "root": { - "providers": [], - "dependencies": [] - }, - "submodules": [ - { - "path": "modules/ec-deployment", - "providers": [ - { - "name": "ec", - "namespace": "", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "dependencies": [] - } - ] + "name": "policy_assignment", + "version_constraint": "", + "source": "./modules/azapi_helper" + }, + { + "name": "policy_definitions", + "version_constraint": "", + "source": "./modules/azapi_helper" + } + ], + "resources": [ + { + "address": "modtm_telemetry.telemetry", + "type": "modtm_telemetry", + "name": "telemetry" + }, + { + "address": "random_uuid.telemetry", + "type": "random_uuid", + "name": "telemetry" + } + ], + "link": "https://github.com/azure/terraform-azurerm-alz/tree/v0.8.1", + "vcs_repository": "", + "licenses": [ + { + "spdx": "MIT", + "confidence": 1, + "is_compatible": true, + "file": "LICENSE", + "link": "https://github.com/azure/terraform-azurerm-alz/blob/v0.8.1/LICENSE" + } + ], + "incompatible_license": false, + "examples": { + "default": { + "readme": true, + "edit_link": "https://github.com/azure/terraform-azurerm-alz/blob/v0.8.1/examples/default/README.md", + "variables": {}, + "outputs": {}, + "schema_error": "" + }, + "policy-assignment-modification-with-custom-lib": { + "readme": true, + "edit_link": "https://github.com/azure/terraform-azurerm-alz/blob/v0.8.1/examples/policy-assignment-modification-with-custom-lib/README.md", + "variables": {}, + "outputs": {}, + "schema_error": "" + } + }, + "submodules": { + "azapi_helper": { + "readme": true, + "edit_link": "https://github.com/azure/terraform-azurerm-alz/blob/v0.8.1/modules/azapi_helper/README.md", + "variables": { + "body": { + "type": "dynamic", + "default": null, + "description": "The body object of the resource.", + "sensitive": false, + "required": true }, - { - "version": "0.0.4", - "root": { - "providers": [ - { - "name": "ec", - "namespace": "", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "dependencies": [] - }, - "submodules": [] + "name": { + "type": "string", + "default": null, + "description": "The name of resource.", + "sensitive": false, + "required": true + } + }, + "outputs": { + "identity": { + "sensitive": false, + "description": "The identity configuration of the resource." }, + "name": { + "sensitive": false, + "description": "The name of the resource." + } + }, + "schema_error": "", + "providers": [], + "dependencies": [], + "resources": [ { - "version": "0.0.3", - "root": { - "providers": [ - { - "name": "ec", - "namespace": "", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "dependencies": [] - }, - "submodules": [] + "address": "azapi_resource.this", + "type": "azapi_resource", + "name": "this" }, { - "version": "0.0.7", - "root": { - "providers": [ - { - "name": "ec", - "namespace": "", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "dependencies": [] - }, - "submodules": [] + "address": "terraform_data.replace_trigger", + "type": "terraform_data", + "name": "replace_trigger" } ] } - ] + } }` -// moduleDataMockResponse represents response from https://registry.terraform.io/v1/modules/puppetlabs/deployment/ec/0.0.8 var moduleDataMockResponse = `{ - "id": "puppetlabs/deployment/ec/0.0.8", - "owner": "mattkirby", - "namespace": "puppetlabs", - "name": "deployment", - "version": "0.0.8", - "provider": "ec", - "provider_logo_url": "/images/providers/generic.svg?2", - "description": "", - "source": "https://github.com/puppetlabs/terraform-ec-deployment", - "tag": "v0.0.8", - "published_at": "2021-08-05T00:26:33.501756Z", - "downloads": 3059237, - "verified": false, - "root": { - "path": "", - "name": "deployment", - "readme": "# EC project Terraform module\n\nTerraform module which creates a Elastic Cloud project.\n\n## Usage\n\nDetails coming soon\n", - "empty": false, - "inputs": [ - { - "name": "autoscale", - "type": "string", - "description": "Enable autoscaling of elasticsearch", - "default": "\"true\"", - "required": false - }, - { - "name": "ec_stack_version", - "type": "string", - "description": "Version of Elastic Cloud stack to deploy", - "default": "\"\"", - "required": false - }, - { - "name": "name", - "type": "string", - "description": "Name of resources", - "default": "\"ecproject\"", - "required": false - }, - { - "name": "traffic_filter_sourceip", - "type": "string", - "description": "traffic filter source IP", - "default": "\"\"", - "required": false - }, - { - "name": "ec_region", - "type": "string", - "description": "cloud provider region", - "default": "\"gcp-us-west1\"", - "required": false - }, - { - "name": "deployment_templateid", - "type": "string", - "description": "ID of Elastic Cloud deployment type", - "default": "\"gcp-io-optimized\"", - "required": false - } - ], - "outputs": [ - { - "name": "elasticsearch_password", - "description": "elasticsearch password" - }, - { - "name": "deployment_id", - "description": "Elastic Cloud deployment ID" - }, - { - "name": "elasticsearch_version", - "description": "Stack version deployed" - }, - { - "name": "elasticsearch_cloud_id", - "description": "Elastic Cloud project deployment ID" - }, - { - "name": "elasticsearch_https_endpoint", - "description": "elasticsearch https endpoint" - }, - { - "name": "elasticsearch_username", - "description": "elasticsearch username" - } - ], - "dependencies": [], - "provider_dependencies": [ - { - "name": "ec", - "namespace": "elastic", - "source": "elastic/ec", - "version": "0.2.1" - } - ], - "resources": [ - { - "name": "ecproject", - "type": "ec_deployment" - }, - { - "name": "gcp_vpc_nat", - "type": "ec_deployment_traffic_filter" - }, - { - "name": "ec_tf_association", - "type": "ec_deployment_traffic_filter_association" - } - ] + "addr": { + "display": "azure/alz/azurerm", + "namespace": "azure", + "name": "alz", + "target": "azurerm" }, - "submodules": [], - "examples": [], - "providers": [ - "ec" - ], + "description": "Terraform module to deploy Azure Landing Zones", "versions": [ - "0.0.1", - "0.0.2", - "0.0.3", - "0.0.4", - "0.0.5", - "0.0.6", - "0.0.7", - "0.0.8" - ] + { + "id": "v0.8.1", + "published": "2024-08-05T17:16:42+01:00" + }, + { + "id": "v0.8.0", + "published": "2024-07-10T16:41:49+01:00" + }, + { + "id": "v0.7.0", + "published": "2024-07-08T17:55:56+01:00" + }, + { + "id": "v0.6.0", + "published": "2024-03-13T12:31:59Z" + }, + { + "id": "v0.5.0", + "published": "2024-03-08T10:29:31Z" + }, + { + "id": "v0.4.1", + "published": "2023-11-06T21:35:38Z" + }, + { + "id": "v0.4.0", + "published": "2023-11-06T21:26:06Z" + }, + { + "id": "v0.3.3", + "published": "2023-11-02T17:22:57Z" + }, + { + "id": "v0.3.2", + "published": "2023-11-02T10:44:07Z" + }, + { + "id": "v0.3.1", + "published": "2023-10-26T14:08:19+01:00" + }, + { + "id": "v0.3.0", + "published": "2023-10-09T20:19:28+01:00" + }, + { + "id": "v0.2.0", + "published": "2023-10-06T16:56:28+01:00" + }, + { + "id": "v0.1.1", + "published": "2023-08-08T17:26:02+01:00" + }, + { + "id": "v0.1.0", + "published": "2023-08-08T15:43:59+01:00" + } + ], + "is_blocked": false }` diff --git a/internal/registry/module_test.go b/internal/registry/module_test.go index 690c1189d..e951139c4 100644 --- a/internal/registry/module_test.go +++ b/internal/registry/module_test.go @@ -1,3 +1,5 @@ +// Copyright (c) Gamunu Balagalla. +// SPDX-License-Identifier: MPL-2.0 // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 @@ -19,25 +21,24 @@ import ( func TestGetModuleData(t *testing.T) { ctx := context.Background() - addr, err := tfaddr.ParseModuleSource("puppetlabs/deployment/ec") + addr, err := tfaddr.ParseModuleSource("azure/alz/azurerm") if err != nil { t.Fatal(err) } - cons := version.MustConstraints(version.NewConstraint("0.0.8")) + cons := version.MustConstraints(version.NewConstraint("0.8.1")) client := NewClient() srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI == "/v1/modules/puppetlabs/deployment/ec/versions" { - w.Write([]byte(moduleVersionsMockResponse)) - return - } - if r.RequestURI == "/v1/modules/puppetlabs/deployment/ec/0.0.8" { + switch r.RequestURI { + case "/modules/azure/alz/azurerm/index.json": w.Write([]byte(moduleDataMockResponse)) - return + case "/modules/azure/alz/azurerm/v0.8.1/index.json": + w.Write([]byte(moduleVersionsMockResponse)) + default: + http.Error(w, fmt.Sprintf("unexpected request: %q", r.RequestURI), 400) } - http.Error(w, fmt.Sprintf("unexpected request: %q", r.RequestURI), 400) })) client.BaseURL = srv.URL t.Cleanup(srv.Close) @@ -46,82 +47,103 @@ func TestGetModuleData(t *testing.T) { if err != nil { t.Fatal(err) } - expectedData := &ModuleResponse{ - Version: "0.0.8", - PublishedAt: time.Date(2021, time.August, 5, 0, 26, 33, 501756000, time.UTC), - Root: ModuleRoot{ - Inputs: []Input{ - { - Name: "autoscale", - Type: "string", - Description: "Enable autoscaling of elasticsearch", - Default: "\"true\"", - Required: false, - }, - { - Name: "ec_stack_version", - Type: "string", - Description: "Version of Elastic Cloud stack to deploy", - Default: "\"\"", - Required: false, - }, - { - Name: "name", - Type: "string", - Description: "Name of resources", - Default: "\"ecproject\"", - Required: false, - }, - { - Name: "traffic_filter_sourceip", - Type: "string", - Description: "traffic filter source IP", - Default: "\"\"", - Required: false, - }, - { - Name: "ec_region", - Type: "string", - Description: "cloud provider region", - Default: "\"gcp-us-west1\"", - Required: false, - }, - { - Name: "deployment_templateid", - Type: "string", - Description: "ID of Elastic Cloud deployment type", - Default: "\"gcp-io-optimized\"", - Required: false, - }, + + expectedData := &ModuleDetails{ + ID: "v0.8.1", + Published: time.Date(2024, time.August, 5, 17, 16, 42, 0, time.FixedZone("", 3600)), + Readme: true, + Inputs: map[string]Variable{ + "architecture_name": { + Type: "string", + Description: "The name of the architecture to create. This needs to be*.alz_architecture_definition.[json|yaml|yml] files.\n", + Required: true, }, - Outputs: []Output{ - { - Name: "elasticsearch_password", - Description: "elasticsearch password", - }, - { - Name: "deployment_id", - Description: "Elastic Cloud deployment ID", - }, - { - Name: "elasticsearch_version", - Description: "Stack version deployed", - }, - { - Name: "elasticsearch_cloud_id", - Description: "Elastic Cloud project deployment ID", - }, - { - Name: "elasticsearch_https_endpoint", - Description: "elasticsearch https endpoint", - }, - { - Name: "elasticsearch_username", - Description: "elasticsearch username", + "location": { + Type: "string", + Description: "The default location for resources in this management group. Used for policy managed identities.\n", + Required: true, + }, + }, + Outputs: map[string]Output{ + "management_group_resource_ids": { + Description: "A map of management group names to their resource ids.", + Sensitive: false, + }, + "policy_assignment_resource_ids": { + Description: "A map of policy assignment names to their resource ids.", + Sensitive: false, + }, + }, + Providers: []ProviderDependency{}, + Dependencies: []ModuleDependency{ + { + Name: "policy_assignment", + VersionConstraint: "", + Source: "./modules/azapi_helper", + }, + { + Name: "policy_definitions", + VersionConstraint: "", + Source: "./modules/azapi_helper", + }, + }, + Resources: []Resource{ + { + Address: "modtm_telemetry.telemetry", + Type: "modtm_telemetry", + Name: "telemetry", + }, + { + Address: "random_uuid.telemetry", + Type: "random_uuid", + Name: "telemetry", + }, + }, + Submodules: map[string]Submodule{ + "azapi_helper": { + ModuleDetails: ModuleDetails{ + Readme: true, + Inputs: map[string]Variable{ + "body": { + Type: "dynamic", + Description: "The body object of the resource.", + Required: true, + }, + "name": { + Type: "string", + Description: "The name of resource.", + Required: true, + }, + }, + Outputs: map[string]Output{ + "identity": { + Description: "The identity configuration of the resource.", + Sensitive: false, + }, + "name": { + Description: "The name of the resource.", + Sensitive: false, + }, + }, + Providers: []ProviderDependency{}, + Dependencies: []ModuleDependency{}, + Resources: []Resource{ + { + Address: "azapi_resource.this", + Type: "azapi_resource", + Name: "this", + }, + { + Address: "terraform_data.replace_trigger", + Type: "terraform_data", + Name: "replace_trigger", + }, + }, }, }, }, } + if diff := cmp.Diff(expectedData, data); diff != "" { t.Fatalf("mismatched data: %s", diff) } @@ -129,16 +151,16 @@ func TestGetModuleData(t *testing.T) { func TestGetMatchingModuleVersion(t *testing.T) { ctx := context.Background() - addr, err := tfaddr.ParseModuleSource("puppetlabs/deployment/ec") + addr, err := tfaddr.ParseModuleSource("azure/alz/azurerm") if err != nil { t.Fatal(err) } - cons := version.MustConstraints(version.NewConstraint(">=0.0.7")) + cons := version.MustConstraints(version.NewConstraint(">=0.7.0")) client := NewClient() srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI == "/v1/modules/puppetlabs/deployment/ec/versions" { - w.Write([]byte(moduleVersionsMockResponse)) + if r.RequestURI == "/modules/azure/alz/azurerm/index.json" { + w.Write([]byte(moduleDataMockResponse)) return } http.Error(w, fmt.Sprintf("unexpected request: %q", r.RequestURI), 400) @@ -151,28 +173,73 @@ func TestGetMatchingModuleVersion(t *testing.T) { t.Fatal(err) } - expectedVersion := version.Must(version.NewVersion("0.0.8")) + expectedVersion := version.Must(version.NewVersion("v0.8.1")) if !expectedVersion.Equal(v) { t.Fatalf("expected version: %s, given: %s", expectedVersion, v) } } +func TestGetModuleVersions(t *testing.T) { + ctx := context.Background() + addr, err := tfaddr.ParseModuleSource("azure/alz/azurerm") + if err != nil { + t.Fatal(err) + } + client := NewClient() + + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.RequestURI == "/modules/azure/alz/azurerm/index.json" { + w.Write([]byte(moduleDataMockResponse)) + return + } + http.Error(w, fmt.Sprintf("unexpected request: %q", r.RequestURI), 400) + })) + client.BaseURL = srv.URL + t.Cleanup(srv.Close) + + versions, err := client.GetModuleVersions(ctx, addr) + if err != nil { + t.Fatal(err) + } + + expectedVersions := version.Collection{ + version.Must(version.NewVersion("0.8.1")), + version.Must(version.NewVersion("0.8.0")), + version.Must(version.NewVersion("0.7.0")), + version.Must(version.NewVersion("0.6.0")), + version.Must(version.NewVersion("0.5.0")), + version.Must(version.NewVersion("0.4.1")), + version.Must(version.NewVersion("0.4.0")), + version.Must(version.NewVersion("0.3.3")), + version.Must(version.NewVersion("0.3.2")), + version.Must(version.NewVersion("0.3.1")), + version.Must(version.NewVersion("0.3.0")), + version.Must(version.NewVersion("0.2.0")), + version.Must(version.NewVersion("0.1.1")), + version.Must(version.NewVersion("0.1.0")), + } + + if diff := cmp.Diff(expectedVersions, versions); diff != "" { + t.Fatalf("mismatched versions: %s", diff) + } +} + func TestCancellationThroughContext(t *testing.T) { ctx := context.Background() ctx, cancelFunc := context.WithTimeout(ctx, 50*time.Millisecond) t.Cleanup(cancelFunc) - addr, err := tfaddr.ParseModuleSource("puppetlabs/deployment/ec") + addr, err := tfaddr.ParseModuleSource("azure/alz/azurerm") if err != nil { t.Fatal(err) } - cons := version.MustConstraints(version.NewConstraint(">=0.0.7")) + cons := version.MustConstraints(version.NewConstraint(">=0.7.0")) client := NewClient() srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - time.Sleep(500 * time.Millisecond) - if r.RequestURI == "/v1/modules/puppetlabs/deployment/ec/versions" { - w.Write([]byte(moduleVersionsMockResponse)) + time.Sleep(500 * time.Millisecond) // Delay longer than the context timeout + if r.RequestURI == "/modules/azure/alz/azurerm/index.json" { + w.Write([]byte(moduleDataMockResponse)) return } http.Error(w, fmt.Sprintf("unexpected request: %q", r.RequestURI), 400) @@ -181,12 +248,28 @@ func TestCancellationThroughContext(t *testing.T) { t.Cleanup(srv.Close) _, err = client.GetMatchingModuleVersion(ctx, addr, cons) - e, ok := err.(*url.Error) + if err == nil { + t.Fatal("expected error due to context cancellation, got nil") + } + + urlErr, ok := err.(*url.Error) if !ok { - t.Fatalf("expected error, got %#v", err) + t.Fatalf("expected *url.Error, got: %T", err) + } + + if urlErr.Err != context.DeadlineExceeded { + t.Fatalf("expected context.DeadlineExceeded error, got: %v", urlErr.Err) + } +} + +func TestClientError(t *testing.T) { + err := ClientError{ + StatusCode: 404, + Body: "Not Found", } - if e.Err != context.DeadlineExceeded { - t.Fatalf("expected error: %#v, given: %#v", context.DeadlineExceeded, e.Err) + expected := "404: Not Found" + if err.Error() != expected { + t.Fatalf("expected error message: %s, got: %s", expected, err.Error()) } } diff --git a/internal/registry/provider_test.go b/internal/registry/provider_test.go index b83d25fab..9d3c7dae1 100644 --- a/internal/registry/provider_test.go +++ b/internal/registry/provider_test.go @@ -1,4 +1,4 @@ -// Copyright (c) HashiCorp, Inc. +// Copyright (c) Gamunu Balagalla. // SPDX-License-Identifier: MPL-2.0 package registry @@ -8,6 +8,7 @@ import ( "net/http" "net/http/httptest" "testing" + "time" "github.com/google/go-cmp/cmp" ) @@ -16,252 +17,94 @@ func TestListProviders(t *testing.T) { client := NewClient() srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI == "/v2/providers?page[size]=2&filter[tier]=official&page[number]=1" { + if r.RequestURI == "/providers/index.json" { w.Write([]byte(`{ - "data": [ + "providers": [ { - "type": "providers", - "id": "315", - "attributes": { - "alias": "azuread", - "description": "Manage users, groups, service principals, and applications in Azure Active Directory using the Microsoft Graph API. This provider is maintained by the Azure providers team at HashiCorp.", - "downloads": 46684900, - "featured": false, - "full-name": "hashicorp/azuread", - "logo-url": "/images/providers/azure.svg?3", - "name": "azuread", + "addr": { + "display": "hashicorp/azuread", "namespace": "hashicorp", - "owner-name": "", - "robots-noindex": false, - "source": "https://github.com/hashicorp/terraform-provider-azuread", - "tier": "official", - "unlisted": false, - "warning": "" + "name": "azuread" }, - "links": { - "self": "/v2/providers/315" - } + "description": "Manage Azure Active Directory resources", + "popularity": 1000, + "fork_count": 50, + "versions": [ + { + "id": "0.36.1", + "published": "2022-08-24T19:09:29Z" + } + ], + "is_blocked": false }, { - "type": "providers", - "id": "378", - "attributes": { - "alias": "http", - "description": "Utility provider for interacting with generic HTTP servers as part of a Terraform configuration.", - "downloads": 23888754, - "featured": false, - "full-name": "hashicorp/http", - "logo-url": "/images/providers/hashicorp.svg", - "name": "http", + "addr": { + "display": "hashicorp/http", "namespace": "hashicorp", - "owner-name": "", - "robots-noindex": false, - "source": "https://github.com/hashicorp/terraform-provider-http", - "tier": "official", - "unlisted": false, - "warning": "" + "name": "http" }, - "links": { - "self": "/v2/providers/378" - } + "description": "Interact with HTTP servers", + "popularity": 500, + "fork_count": 20, + "versions": [ + { + "id": "3.2.1", + "published": "2022-06-21T18:56:56Z" + } + ], + "is_blocked": false } - ], - "links": { - "first": "/v2/providers?filter%5Btier%5D=official&page%5Bnumber%5D=1&page%5Bsize%5D=2", - "last": "/v2/providers?filter%5Btier%5D=official&page%5Bnumber%5D=2&page%5Bsize%5D=2", - "next": "/v2/providers?filter%5Btier%5D=official&page%5Bnumber%5D=2&page%5Bsize%5D=2", - "prev": null - }, - "meta": { - "pagination": { - "page-size": 2, - "current-page": 1, - "next-page": 2, - "prev-page": null, - "total-pages": 2, - "total-count": 3 - } - } -} -`)) - return - } - if r.RequestURI == "/v2/providers?page[size]=2&filter[tier]=official&page[number]=2" { - w.Write([]byte(`{ - "data": [ - { - "type": "providers", - "id": "370", - "attributes": { - "alias": "tfe", - "description": "Provision Terraform Cloud or Terraform Enterprise - with Terraform! Management of organizations, workspaces, teams, variables, run triggers, policy sets, and more. Maintained by the Terraform Cloud team at HashiCorp.", - "downloads": 8555685, - "featured": false, - "full-name": "hashicorp/tfe", - "logo-url": "/images/providers/terraform.svg?3", - "name": "tfe", - "namespace": "hashicorp", - "owner-name": "", - "robots-noindex": false, - "source": "https://github.com/hashicorp/terraform-provider-tfe", - "tier": "official", - "unlisted": false, - "warning": "" - }, - "links": { - "self": "/v2/providers/370" - } - } - ], - "links": { - "first": "/v2/providers?filter%5Btier%5D=official&page%5Bnumber%5D=1&page%5Bsize%5D=2", - "last": "/v2/providers?filter%5Btier%5D=official&page%5Bnumber%5D=2&page%5Bsize%5D=2", - "next": null, - "prev": "/v2/providers?filter%5Btier%5D=official&page%5Bnumber%5D=1&page%5Bsize%5D=2" - }, - "meta": { - "pagination": { - "page-size": 2, - "current-page": 1, - "next-page": null, - "prev-page": 1, - "total-pages": 2, - "total-count": 3 - } - } -} -`)) + ] +}`)) return } http.Error(w, fmt.Sprintf("unexpected request: %q", r.RequestURI), 400) })) client.BaseURL = srv.URL - client.ProviderPageSize = 2 t.Cleanup(srv.Close) - providers, err := client.ListProviders("official") + providers, err := client.ListProviders() if err != nil { t.Fatal(err) } expectedProviders := []Provider{ { - ID: "315", - Attributes: ProviderAttributes{ + Addr: ProviderAddr{ + Display: "hashicorp/azuread", Name: "azuread", Namespace: "hashicorp", }, + Description: "Manage Azure Active Directory resources", + Popularity: 1000, + ForkCount: 50, + Versions: []ProviderVersion{ + { + ID: "0.36.1", + Published: time.Date(2022, 8, 24, 19, 9, 29, 0, time.UTC), + }, + }, + IsBlocked: false, }, { - ID: "378", - Attributes: ProviderAttributes{ + Addr: ProviderAddr{ + Display: "hashicorp/http", Name: "http", Namespace: "hashicorp", }, - }, - { - ID: "370", - Attributes: ProviderAttributes{ - Name: "tfe", - Namespace: "hashicorp", + Description: "Interact with HTTP servers", + Popularity: 500, + ForkCount: 20, + Versions: []ProviderVersion{ + { + ID: "3.2.1", + Published: time.Date(2022, 6, 21, 18, 56, 56, 0, time.UTC), + }, }, + IsBlocked: false, }, } if diff := cmp.Diff(expectedProviders, providers); diff != "" { t.Fatalf("unexpected providers: %s", diff) } } - -func TestGetLatestProviderVersion(t *testing.T) { - client := NewClient() - - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI == "/v2/providers/370/provider-versions/latest?include=provider-platforms" { - w.Write([]byte(`{ - "data": { - "type": "provider-versions", - "id": "27307", - "attributes": { - "description": "terraform-provider-tfe", - "downloads": 243313, - "published-at": "2022-08-24T19:09:29Z", - "tag": "v0.36.1", - "version": "0.36.1" - }, - "relationships": { - "platforms": { - "data": [ - { - "type": "provider-platforms", - "id": "287323" - }, - { - "type": "provider-platforms", - "id": "287326" - } - ] - } - }, - "links": { - "self": "/v2/provider-versions/27307" - } - }, - "included": [ - { - "type": "provider-platforms", - "id": "287327", - "attributes": { - "arch": "arm", - "downloads": 237, - "os": "freebsd" - } - }, - { - "type": "provider-platforms", - "id": "287324", - "attributes": { - "arch": "arm64", - "downloads": 2481, - "os": "darwin" - } - } - ] -}`)) - return - } - })) - client.BaseURL = srv.URL - t.Cleanup(srv.Close) - - resp, err := client.GetLatestProviderVersion("370") - if err != nil { - t.Fatal(err) - } - - expectedResponse := &ProviderVersionResponse{ - Data: ProviderVersionData{ - Attributes: ProviderVersionAttributes{ - Version: "0.36.1", - }, - }, - Included: []Included{ - { - Type: "provider-platforms", - Attributes: IncludedAttributes{ - Arch: "arm", - Os: "freebsd", - }, - }, - { - Type: "provider-platforms", - Attributes: IncludedAttributes{ - Arch: "arm64", - Os: "darwin", - }, - }, - }, - } - if diff := cmp.Diff(expectedResponse, resp); diff != "" { - t.Fatalf("unexpected response: %s", diff) - } -}