-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
451e1bc
commit 83c0c42
Showing
9 changed files
with
107 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package schema | ||
|
||
import ( | ||
"github.com/hashicorp/go-version" | ||
"github.com/hashicorp/hcl-lang/schema" | ||
|
||
v014_mod "github.com/hashicorp/terraform-schema/internal/schema/0.14" | ||
) | ||
|
||
func ModuleSchema(v *version.Version) *schema.BodySchema { | ||
bs := v014_mod.ModuleSchema(v) | ||
bs.Blocks["terraform"] = patchTerraformBlockSchema(bs.Blocks["terraform"], v) | ||
return bs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package schema | ||
|
||
import ( | ||
"github.com/hashicorp/go-version" | ||
"github.com/hashicorp/hcl-lang/lang" | ||
"github.com/hashicorp/hcl-lang/schema" | ||
"github.com/zclconf/go-cty/cty" | ||
) | ||
|
||
func patchTerraformBlockSchema(bs *schema.BlockSchema, v *version.Version) *schema.BlockSchema { | ||
bs.Body.Blocks["required_providers"].Body = &schema.BodySchema{ | ||
AnyAttribute: &schema.AttributeSchema{ | ||
Expr: schema.ExprConstraints{ | ||
schema.ObjectExpr{ | ||
Attributes: schema.ObjectExprAttributes{ | ||
"source": schema.ObjectAttribute{ | ||
Expr: schema.LiteralTypeOnly(cty.String), | ||
Description: lang.Markdown("The global source address for the provider " + | ||
"you intend to use, such as `hashicorp/aws`"), | ||
}, | ||
"version": schema.ObjectAttribute{ | ||
Expr: schema.LiteralTypeOnly(cty.String), | ||
Description: lang.Markdown("Version constraint specifying which subset of " + | ||
"available provider versions the module is compatible with, e.g. `~> 1.0`"), | ||
}, | ||
"configuration_aliases": schema.ObjectAttribute{ | ||
Expr: schema.ExprConstraints{ | ||
schema.TupleConsExpr{ | ||
Name: "set of aliases", | ||
}, | ||
}, | ||
Description: lang.Markdown("Aliases under which to make the provider available, " + | ||
"such as `[ aws.eu-west, aws.us-east ]`"), | ||
}, | ||
}, | ||
}, | ||
schema.LiteralTypeExpr{Type: cty.String}, | ||
}, | ||
Description: lang.Markdown("Provider source, version constraint and its aliases"), | ||
}, | ||
} | ||
return bs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters