From 6de9f26d2e4a1e43defd16eb14d824b042529250 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 4 Feb 2026 09:31:33 +0100 Subject: [PATCH] update core schema with deprecation --- internal/schema/1.15/output_block.go | 20 ++++++++++++++++++++ internal/schema/1.15/root.go | 20 ++++++++++++++++++++ internal/schema/1.15/variable_block.go | 20 ++++++++++++++++++++ schema/core_schema.go | 5 +++++ schema/versions_gen.go | 8 +++++++- 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 internal/schema/1.15/output_block.go create mode 100644 internal/schema/1.15/root.go create mode 100644 internal/schema/1.15/variable_block.go diff --git a/internal/schema/1.15/output_block.go b/internal/schema/1.15/output_block.go new file mode 100644 index 00000000..5599e3ed --- /dev/null +++ b/internal/schema/1.15/output_block.go @@ -0,0 +1,20 @@ +// Copyright IBM Corp. 2020, 2026 +// SPDX-License-Identifier: MPL-2.0 + +package schema + +import ( + "github.com/hashicorp/hcl-lang/lang" + "github.com/hashicorp/hcl-lang/schema" + "github.com/zclconf/go-cty/cty" +) + +func patchOutputBlockSchema(bs *schema.BlockSchema) *schema.BlockSchema { + bs.Body.Attributes["deprecated"] = &schema.AttributeSchema{ + Constraint: schema.LiteralType{Type: cty.String}, + IsOptional: true, + Description: lang.Markdown("Setting this value marks the output as deprecated. The string value provided should describe the reason for deprecation and suggest an alternative. Any usage of a deprecated output will result in a warning being emitted to the user."), + } + + return bs +} diff --git a/internal/schema/1.15/root.go b/internal/schema/1.15/root.go new file mode 100644 index 00000000..ec7ce817 --- /dev/null +++ b/internal/schema/1.15/root.go @@ -0,0 +1,20 @@ +// Copyright IBM Corp. 2020, 2026 +// SPDX-License-Identifier: MPL-2.0 + +package schema + +import ( + "github.com/hashicorp/go-version" + "github.com/hashicorp/hcl-lang/schema" + + v1_14_mod "github.com/hashicorp/terraform-schema/internal/schema/1.14" +) + +func ModuleSchema(v *version.Version) *schema.BodySchema { + bs := v1_14_mod.ModuleSchema(v) + + bs.Blocks["variable"] = patchVariableBlockSchema(bs.Blocks["variable"]) + bs.Blocks["output"] = patchOutputBlockSchema(bs.Blocks["output"]) + + return bs +} diff --git a/internal/schema/1.15/variable_block.go b/internal/schema/1.15/variable_block.go new file mode 100644 index 00000000..c4aef05d --- /dev/null +++ b/internal/schema/1.15/variable_block.go @@ -0,0 +1,20 @@ +// Copyright IBM Corp. 2020, 2026 +// SPDX-License-Identifier: MPL-2.0 + +package schema + +import ( + "github.com/hashicorp/hcl-lang/lang" + "github.com/hashicorp/hcl-lang/schema" + "github.com/zclconf/go-cty/cty" +) + +func patchVariableBlockSchema(bs *schema.BlockSchema) *schema.BlockSchema { + bs.Body.Attributes["deprecated"] = &schema.AttributeSchema{ + Constraint: schema.LiteralType{Type: cty.String}, + IsOptional: true, + Description: lang.Markdown("Setting this value marks the variable as deprecated. The string value provided should describe the reason for deprecation and suggest an alternative. Any usage of a deprecated variable will result in a warning being emitted to the user."), + } + + return bs +} diff --git a/schema/core_schema.go b/schema/core_schema.go index 094229b5..ddc6a3ac 100644 --- a/schema/core_schema.go +++ b/schema/core_schema.go @@ -14,6 +14,7 @@ import ( mod_v1_10 "github.com/hashicorp/terraform-schema/internal/schema/1.10" mod_v1_12 "github.com/hashicorp/terraform-schema/internal/schema/1.12" mod_v1_14 "github.com/hashicorp/terraform-schema/internal/schema/1.14" + mod_v1_15 "github.com/hashicorp/terraform-schema/internal/schema/1.15" mod_v1_2 "github.com/hashicorp/terraform-schema/internal/schema/1.2" mod_v1_4 "github.com/hashicorp/terraform-schema/internal/schema/1.4" mod_v1_5 "github.com/hashicorp/terraform-schema/internal/schema/1.5" @@ -40,6 +41,7 @@ var ( v1_10 = version.Must(version.NewVersion("1.10")) v1_12 = version.Must(version.NewVersion("1.12")) v1_14 = version.Must(version.NewVersion("1.14.0-beta1")) + v1_15 = version.Must(version.NewVersion("1.15.0-alpha20260204")) ) // CoreModuleSchemaForVersion finds a module schema which is relevant @@ -47,6 +49,9 @@ var ( // It will return error if such schema cannot be found. func CoreModuleSchemaForVersion(v *version.Version) (*schema.BodySchema, error) { ver := v.Core() + if ver.GreaterThanOrEqual(v1_15) { + return mod_v1_15.ModuleSchema(ver), nil + } if ver.GreaterThanOrEqual(v1_14) { return mod_v1_14.ModuleSchema(ver), nil } diff --git a/schema/versions_gen.go b/schema/versions_gen.go index 7fd35cd8..fb57125e 100755 --- a/schema/versions_gen.go +++ b/schema/versions_gen.go @@ -7,10 +7,16 @@ import ( var ( OldestAvailableVersion = version.Must(version.NewVersion("0.12.0")) - LatestAvailableVersion = version.Must(version.NewVersion("1.14.0")) + LatestAvailableVersion = version.Must(version.NewVersion("1.14.4")) terraformVersions = version.Collection{ + version.Must(version.NewVersion("1.15.0-alpha20260204")), + version.Must(version.NewVersion("1.15.0-alpha20251203")), version.Must(version.NewVersion("1.15.0-alpha20251119")), + version.Must(version.NewVersion("1.14.4")), + version.Must(version.NewVersion("1.14.3")), + version.Must(version.NewVersion("1.14.2")), + version.Must(version.NewVersion("1.14.1")), version.Must(version.NewVersion("1.14.0")), version.Must(version.NewVersion("1.14.0-rc2")), version.Must(version.NewVersion("1.14.0-rc1")),