Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions internal/schema/1.15/output_block.go
Original file line number Diff line number Diff line change
@@ -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
}
20 changes: 20 additions & 0 deletions internal/schema/1.15/root.go
Original file line number Diff line number Diff line change
@@ -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
}
20 changes: 20 additions & 0 deletions internal/schema/1.15/variable_block.go
Original file line number Diff line number Diff line change
@@ -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
}
5 changes: 5 additions & 0 deletions schema/core_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -40,13 +41,17 @@ 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
// for the given Terraform version.
// 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
}
Expand Down
8 changes: 7 additions & 1 deletion schema/versions_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading