hcl2 | Former temporary home for experimental new version of HCL | Configuration Management library
kandi X-RAY | hcl2 Summary
kandi X-RAY | hcl2 Summary
This repository was used for the initial development of version 2 of HCL, but is now archived because the work from this repository was incorporated back in to the main HCL repository. This repository remains here for the moment for compatibility with existing callers that imported the experimental version. We strongly encourage switching to a stable release of HCL 2 as soon as possible. For more information on installing HCL 1 and/or HCL 2, please see the Version Selection guide. There will be no further development in this temporary experimental HCL 2 repository.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of hcl2
hcl2 Key Features
hcl2 Examples and Code Snippets
Community Discussions
Trending Discussions on hcl2
QUESTION
I am attempting to write a go program that reads in a terraform variables.tf
and populates a struct for later manipulation. However, I am getting errors when attempting to "parse" the file. I Am hoping someone can tell me what I am doing wrong:
Code:
...ANSWER
Answered 2021-Mar-14 at 04:40It looks like it's a bug/feature of the library, since as soon as you change string
to "string"
, e.g.,
QUESTION
When I try to use interpolation syntax like this:
...ANSWER
Answered 2021-Jan-24 at 16:40You just have to get the id without using double quotes vpc_id = aws_vpc.prod-vpc.id
because you are getting vpc id from the resource.
If you use the double quotes, it will be considered as a string and no evaluation will be done, and terraform will consider "aws_vpc.prod-vpc.id"
as the id.
This is the corrected code:
QUESTION
I am trying to edit Terraform configuration files with Python. I am parsing Terraform files (.tf) using python hcl2 library which returns a python dictionary. I want to add new key/value pairs or change some values in the dictionary. Directly writing to the file is not a good practice since the returned python dictionary is not in Hashicorp Configuration Language format. Also there can be multiple configuration files like variables.tf etc. which are linked together. Should I implement my own serializer which converts python dictionary to terraform configuration file or is there an easier way to do it?
...ANSWER
Answered 2021-Jan-13 at 00:07The python-hcl2
library implements a parser for the HCL syntax, but it doesn't have a serializer, and its API is designed to drop all of the HCL specifics and retain only a basic Python data structure, so it doesn't seem to retain enough information to surgically modify the input without losing details such as comments, ordering of attributes, etc.
At the time I'm writing this, the only HCL implementation that explicitly supports updating existing configuration files in-place is the Go package hclwrite
. It allows callers to load in arbitrary HCL source, surgically modify parts of it, and then re-serialize that updated version with only minor whitespace normalization to the unchanged parts of the input.
In principle it would be possible to port hclwrite
to Python, or to implement a serializer from a dictionary like python-hcl2
returns if you are not concerned with preserving unchanged input, but both of these seem like a significant project.
If you do decide to do it, one part that warrants careful attention is serialization of strings into HCL syntax, because the required escaping isn't exactly the same as any other language. You might wish to refer to the escapeQuotedStringLit
function from hclwrite
to see all of the cases to handle, so you can potentially implement compatible logic in Python.
QUESTION
Now I am in process of migrating to Terraform 12. One of the main feature here is more strict HCL2 and I like it.
For example if I have list of maps:
...ANSWER
Answered 2020-Sep-05 at 13:49I get where you are going. But I don't think it is currently possible to "expand" a map inside a resource for example. You could define a map variable with default values, although this is more lines of code.
QUESTION
With the release of Packer 1.6 came several depreciated fields in the vsphere-iso builder. From the looks of it, seems to be a format/type change because the fields actually still exists but just as properties it seems. An example of the changes are the following:
Working in Packer 1.5.6:
JSON
...ANSWER
Answered 2020-Aug-10 at 17:10The correct syntax is the following:
QUESTION
I am trying to set "not included" font to OnePress template. I tried plugins and etc. but it doesn't work. Same with CSS. For example, I used this:
...ANSWER
Answered 2020-Mar-24 at 18:34Use @font-face and import the font directly on your style file
For example
QUESTION
I am trying to get the private subnets in my VPC, I'm using an example from the Terraform docs https://www.terraform.io/docs/providers/aws/d/subnet_ids.html but this is giving me errors.
Here is my code (I commented out the filter, so this should get all subnets - my vpc has 3 public and 3 private subnets)
...ANSWER
Answered 2019-Sep-05 at 15:38The output of the aws_subnet_ids
data is a set and not a list. You would need to convert it to a list. You can achieve this with the tolist
function documented here.
Your code could be updated as follows:
QUESTION
Within Octopus Deploy I've setup a Terraform Apply Step using their Apply a Terraform template
In my Terraform main.tf file I want to use a connection to run an remote-exec on a Amazon Linux EC2 instance in AWS
...ANSWER
Answered 2019-Aug-06 at 16:12The correct syntax for a "flush heredoc" does not include a dash on the final marker:
QUESTION
I am combining a multi select form to a single input using JavaScript. But I am getting the input cut off using any delimiters. When the Controller gets the request I'm only getting the first item selected. I've checked to make sure the form variable is getting updated so I think it's the controller. What am I missing?
View:
...ANSWER
Answered 2017-Aug-02 at 18:50Most likely, the form is submitting too fast. You should use preventDefault
first, and then manually submit after you make the necessary updates to the form data:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install hcl2
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page