Skip to content

Commit

Permalink
Add the Variable struct
Browse files Browse the repository at this point in the history
Adding a struct to represent the variable block in the terraform files
This will help in storing this values while parsing tf files.
  • Loading branch information
Nepomuceno committed May 27, 2021
1 parent 6d07fd6 commit 49b7c13
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion module/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package module

import (
"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform-registry-address"
tfaddr "github.com/hashicorp/terraform-registry-address"
)

type Meta struct {
Expand All @@ -11,6 +11,7 @@ type Meta struct {
ProviderReferences map[ProviderRef]tfaddr.Provider
ProviderRequirements map[tfaddr.Provider]version.Constraints
CoreRequirements version.Constraints
Variables map[string]Variable
}

type ProviderRef struct {
Expand Down
17 changes: 17 additions & 0 deletions module/variable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package module

import (
"github.com/hashicorp/hcl-lang/schema"
"github.com/zclconf/go-cty/cty"
)

type Variable struct {
Description string
Type cty.Type
TypeConstraints schema.ExprConstraints
DefaultValue cty.Value

// In case the version it is before 0.14 sensitive will always be false
// that was actually the default value for prior versions
IsSensitive bool
}

0 comments on commit 49b7c13

Please sign in to comment.