Questions tagged [hcl]

HashiCorp Configuration Language. The structured configuration syntax that serves as the basis for Terraform's configuration language.

HCL establishes the syntax Terraform uses for things like arguments, blocks, literal values, and expressions. But what most people think of as the Terraform language extends beyond just the syntax; the built-in functions, Terraform-specific block types (like resource and variable), and Terraform-specific named values available in expressions are all implementation details of Terraform itself.

Source: https://www.terraform.io/docs/glossary.html#hcl

291 questions
3
votes
1 answer

bypass input values in GitHub Actions workflow to a terraform variables file

As part of provisioning google cloud resources with GitHub actions using terraform I need to bypass some input values using terraform variables file, the issue is THL does not support Golang. I have tried to do the following: Create a GitHub…
3
votes
2 answers

How to calculate with dates in Terraform

Aaccording to Terraform documentation I am trying to calculate a max. start date in Terraform, which has to be the first day of the month within the next 12 monthes. I found this post which let me start to implement it like the following example: …
MaxiPalle
  • 410
  • 1
  • 6
  • 15
3
votes
1 answer

Conditionally enable or disable modules in root main.tf terraform

How do we select or disable modules in root main.tf Example: module "foo" { source = "bar" count = "${var.include_module ? 1 : 0}" } Above one does not work, as per terraform issue discussion link Any alternate method ?
3
votes
3 answers

AWS IP address to use in terraform IPSec tunnels (via Transit Gateway)

I'm trying to build an AWS terraform IPSec VPN config. However, I can't remember where to find the AWS IPSec IP address; the terraform cgw documentation says the ip_address field is required. The answer should assume the VPN will be attached to my…
Mike Pennington
  • 41,899
  • 19
  • 136
  • 174
3
votes
2 answers

Unable to read terraform variables.tf files into may go program

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…
Super Nerd
  • 98
  • 1
  • 8
3
votes
0 answers

packer hcl2 how to use locals in -var-file or alternative pattern

in my original json for packer it was easy to assemble variables which reference other variables. Now that packer recommends to use hcl2 i am wondering how to use this pattern (or antipattern in hcl2) . The basic run was packer build -var-file…
Mandragor
  • 4,684
  • 7
  • 25
  • 40
3
votes
0 answers

HCL in userdata.sh unable to interpret shell script variables Terraform

I have this kind of userdata.sh (plz see below) that is used to spin up an EC2 instance. However, hcl file is unable to interpret the shell script variable. I intend to set tls_disable = true, but this part keeps getting skipped as hcl seems unable…
Piljae Chae
  • 987
  • 10
  • 23
3
votes
1 answer

How to force delete Docker image with terraform destroy

I was following a tutorial on terraform.io that has me provision a docker image and container using terraform, and then destroy the terraform stack. However, I get the following error: Error: Unable to remove Docker image: Error response from…
Yann Stoneman
  • 953
  • 11
  • 35
3
votes
1 answer

Terraform import module state

terraform module: resource "netbox_device" "device" { name = var.name site = var.site tenant = var.tenant rack = var.rack position = var.position type = var.type role = var.role status =…
I.Kulakov
  • 43
  • 1
  • 6
3
votes
1 answer

Ommit optional blocks in terraform module

Currently I'm trying to create a universal sql_database module in Terraform. I want to have control over arguments I want to include in this resource. For example one time I need only required arguments but next time in another project I need them…
Bater55
  • 73
  • 1
  • 9
3
votes
1 answer

Merge fails in terraform

Consider I have a variable - [ { "outer_key_1" = [ { "ip_cidr" = "172.16.6.0/24" "range_name" = "range1" }, { "ip_cidr" = "172.16.7.0/24" "range_name" = "range2" }, { …
leoOrion
  • 1,833
  • 2
  • 26
  • 52
3
votes
1 answer

Use multiple conditions for count in terraform ternary operations using elseif

I am trying to get terraform to create a resouce based on the count conditon as below, i cant get my head around the syntax, it should be something like below: count = “${var.size[terraform.workspace] == "big" ? && local.ips[terraform.workspace] !=…
3
votes
1 answer

Can anyone help to parse HCL?

I'm going to parse HCL configuration file using this repository. package main import ( "fmt" hclParser "github.com/hashicorp/hcl/hcl/parser" ) const ( EXAMPLE_CONFIG_STRING = "log_dir = \"/var/log\"" ) func main() { // parse HCL…
cdevman
  • 119
  • 2
  • 14
2
votes
1 answer

Variables in the HCL file cannot be parsed

I have a Go project where I want to read a HCL file. This HCL file contains variables. However, I cannot parse it and I get the following error message: Variables not allowed; Variables may not be used here., and 1 other diagnostic(s) My Go…
matt-rock
  • 133
  • 2
  • 14
2
votes
1 answer

How can I delete a mail database in HCL Domino over Lotus Script?

I would like to delete a mail database over a notes agent. Sometimes the mail databases have a replica. Whats the best way to delete the mail file itself and also all other replicas (if they exist)? My code below looks like this, but it doesn't…
Baku Bakar
  • 442
  • 2
  • 8
  • 20
1 2
3
19 20