Comments (3)
Hello,
This issue seems to be due to the definition of variable block.
In hcl_parse_type_types.go variable block is define as :
type hclNameDescription struct { Name string hcl:"name,label" Default hcl.Attributes hcl:",remain" } type hclVariable hclNameDescription
The variable block only expect : a name label + attributes. But with terrraform 13, we can add a block "validation" --> it fails.
from terraform-validator.
Hey guys,
What a pleasure to here from you ! How are you ?
About the issue, you're very right. In fact it's quite borring to follow terraform evolvs. Maybe I should migrate from hcl parser into terraform one so that it follows automatically the updates ... But I'll need some times to do so.
In the meanwhile, the following new definition should do the job, but I need to test it ;)
type hclVariable struct {
Name string `hcl:"name,label"`
Validation hcl.Block `hcl:"validation,block"` #cool
Default hcl.Attributes `hcl:"default,remain"`
}
or maybe I'll need to create another type (cf backend in hclTerraform struct)
from terraform-validator.
Hey @thazelart,
Is there any timeline for adding this functionality to a 3.1.x
release? It'd be nice to be able to use this tool, but validation
blocks are used throughout most of my codebases since it was introduced in 0.13
of Terraform.
I will add that changing the hclVariable
struct as you mentioned did not work for me.
diff --git a/internal/hcl/hcl_parse_hcl_types.go b/internal/hcl/hcl_parse_hcl_types.go
index c5df269..6857f2f 100644
--- a/internal/hcl/hcl_parse_hcl_types.go
+++ b/internal/hcl/hcl_parse_hcl_types.go
@@ -8,7 +8,11 @@ type hclNameDescription struct {
Name string `hcl:"name,label"`
Default hcl.Attributes `hcl:"default,remain"`
}
-type hclVariable hclNameDescription
+type hclVariable struct {
+ Name string `hcl:"name,label"`
+ Validation hcl.Block `hcl:"validation,block"`
+ Default hcl.Attributes `hcl:"default,remain"`
+}
type hclOutput hclNameDescription
type hclModule hclNameDescription
from terraform-validator.
Related Issues (15)
- Reduce main complexity HOT 1
- Add `terraform validate` test HOT 2
- Add `terraform fmt` test
- add `terraform-docs` test
- terraform-validator is not HCL2/Terraform0.12 compatible
- Terraform-validator should check recursively
- Add the possibility of prohibiting certain types of resources HOT 1
- Add ensure outputs/variables description set
- Hcl2 error in provider.tf HOT 7
- Blocks of type "required_providers" are not expected here HOT 6
- chore: move documentation to ReadTheDocs
- Allow existence check of a non *.tf file
- Terraform v0.13 way to handle providers version
- Enforce presence of a block in a file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-validator.