Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/schema: Replace TupleConsExpr with SetExpr #169

Merged
merged 2 commits into from
Dec 13, 2022
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/google/go-cmp v0.5.9
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hcl-lang v0.0.0-20221130131410-9f07ba77f1d7
github.com/hashicorp/hcl-lang v0.0.0-20221213144118-12ed55dc4488
github.com/hashicorp/hcl/v2 v2.15.0
github.com/hashicorp/terraform-json v0.14.0
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09
github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/hcl-lang v0.0.0-20221130131410-9f07ba77f1d7 h1:RGomyhrMBFUmenD2BW44yzes99+50RgLthjoiX673+o=
github.com/hashicorp/hcl-lang v0.0.0-20221130131410-9f07ba77f1d7/go.mod h1:it6xaAkaNpJd9WicHQmPMb88VKpp+S2PwB+5GPOuVYc=
github.com/hashicorp/hcl-lang v0.0.0-20221213144118-12ed55dc4488 h1:M84SjUpmvXQfz2MnI/G3XlBZ2Vv44V16t6bj5zja4DY=
github.com/hashicorp/hcl-lang v0.0.0-20221213144118-12ed55dc4488/go.mod h1:NR4/o2Ur8BItrAtCw6dH5xVpPitcr0D2epIoibezXuU=
github.com/hashicorp/hcl/v2 v2.15.0 h1:CPDXO6+uORPjKflkWCCwoWc9uRp+zSIPcCQ+BrxV7m8=
github.com/hashicorp/hcl/v2 v2.15.0/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s=
Expand Down
5 changes: 2 additions & 3 deletions internal/schema/0.12/data_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ func datasourceBlockSchema(v *version.Version) *schema.BlockSchema {
},
"depends_on": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{
Name: "set of references",
AnyElem: schema.ExprConstraints{
schema.SetExpr{
Elem: schema.ExprConstraints{
schema.TraversalExpr{OfScopeId: refscope.DataScope},
schema.TraversalExpr{OfScopeId: refscope.ModuleScope},
schema.TraversalExpr{OfScopeId: refscope.ResourceScope},
Expand Down
5 changes: 2 additions & 3 deletions internal/schema/0.12/output_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ func outputBlockSchema() *schema.BlockSchema {
},
"depends_on": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{
Name: "set of references",
AnyElem: schema.ExprConstraints{
schema.SetExpr{
Elem: schema.ExprConstraints{
schema.TraversalExpr{OfScopeId: refscope.DataScope},
schema.TraversalExpr{OfScopeId: refscope.ModuleScope},
schema.TraversalExpr{OfScopeId: refscope.ResourceScope},
Expand Down
7 changes: 3 additions & 4 deletions internal/schema/0.12/resource_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ func resourceBlockSchema(v *version.Version) *schema.BlockSchema {
},
"depends_on": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{
Name: "set of references",
AnyElem: schema.ExprConstraints{
schema.SetExpr{
Elem: schema.ExprConstraints{
schema.TraversalExpr{OfScopeId: refscope.DataScope},
schema.TraversalExpr{OfScopeId: refscope.ModuleScope},
schema.TraversalExpr{OfScopeId: refscope.ResourceScope},
Expand Down Expand Up @@ -102,7 +101,7 @@ func lifecycleBlock() *schema.BlockSchema {
},
"ignore_changes": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{},
schema.SetExpr{},
schema.KeywordExpr{
Keyword: "all",
Description: lang.Markdown("Ignore all attributes, which means that Terraform can create" +
Expand Down
7 changes: 3 additions & 4 deletions internal/schema/0.12/terraform_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ func terraformBlockSchema(v *version.Version) *schema.BlockSchema {
}

if v.GreaterThanOrEqual(v0_12_18) {
experiments := schema.TupleConsExpr{
AnyElem: schema.ExprConstraints{},
Name: "set of features",
experiments := schema.SetExpr{
Elem: schema.ExprConstraints{},
}
if v.GreaterThanOrEqual(v0_12_20) {
experiments.AnyElem = append(experiments.AnyElem, schema.KeywordExpr{
experiments.Elem = append(experiments.Elem, schema.KeywordExpr{
Keyword: "variable_validation",
Name: "feature",
})
Expand Down
5 changes: 2 additions & 3 deletions internal/schema/0.13/module_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ func moduleBlockSchema() *schema.BlockSchema {
},
"depends_on": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{
Name: "set of references",
AnyElem: schema.ExprConstraints{
schema.SetExpr{
Elem: schema.ExprConstraints{
schema.TraversalExpr{OfScopeId: refscope.DataScope},
schema.TraversalExpr{OfScopeId: refscope.ModuleScope},
schema.TraversalExpr{OfScopeId: refscope.ResourceScope},
Expand Down
4 changes: 1 addition & 3 deletions internal/schema/0.13/terraform_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func terraformBlockSchema(v *version.Version) *schema.BlockSchema {
},
"experiments": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{
Name: "set of features",
},
schema.SetExpr{},
},
IsOptional: true,
Description: lang.Markdown("A set of experimental language features to enable"),
Expand Down
5 changes: 2 additions & 3 deletions internal/schema/0.14/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ func terraformBlockSchema(v *version.Version) *schema.BlockSchema {
},
"experiments": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{
Name: "set of features",
AnyElem: schema.ExprConstraints{
schema.SetExpr{
Elem: schema.ExprConstraints{
schema.KeywordExpr{
Keyword: "module_variable_optional_attrs",
Name: "feature",
Expand Down
7 changes: 3 additions & 4 deletions internal/schema/1.2/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func resourceLifecycleBlock() *schema.BlockSchema {
},
"ignore_changes": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{},
schema.SetExpr{},
schema.KeywordExpr{
Keyword: "all",
Description: lang.Markdown("Ignore all attributes, which means that Terraform can create" +
Expand All @@ -38,9 +38,8 @@ func resourceLifecycleBlock() *schema.BlockSchema {
},
"replace_triggered_by": {
Expr: schema.ExprConstraints{
schema.TupleConsExpr{
Name: "set of references",
AnyElem: schema.ExprConstraints{
schema.SetExpr{
Elem: schema.ExprConstraints{
schema.TraversalExpr{OfScopeId: refscope.ResourceScope},
},
},
Expand Down