Giter VIP home page Giter VIP logo

Comments (3)

amadosdiop avatar amadosdiop commented on June 21, 2024 1

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.

thazelart avatar thazelart commented on June 21, 2024

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.

rogeruiz avatar rogeruiz commented on June 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.