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
1
vote
1 answer

How to allow an ordered list in a custom terraform provider resource?

I have a custom terraform provider with a resource that takes a list as one of its inputs. Here is the list in question:…
Alex Cohen
  • 5,596
  • 16
  • 54
  • 104
1
vote
1 answer

base64encode in Nomad job file not encoding value of variable

I'm trying to store the result of a base64encode inside an env block like so: env { HOST_ID = "${base64encode("${NOMAD_ADDR_serviceA}")}" } Which results in HOST_ID holding the base64 encoded string "${NOMAD_ADDR_serviceA}" and not the value of…
obviyus
  • 134
  • 1
  • 9
1
vote
1 answer

Question About Terraform Language (Count)

data "aws_availability_zones" "available" { state = "available" } resource "aws_subnet" "subnet" { count = length(data.aws.availability_zones.available.names) # ... } let say the legion in my area has 4 availability zones. (A,B,C,D) and the…
Glassline
  • 17
  • 4
1
vote
2 answers

convert terraform HCL variable type=map(any) to JSON

I am trying to convert an terraform variable written in HCL to a dynamically generated tf.json file containing the variable, but I am running into errors. HCL version I am trying to convert: variable "accounts" { type = map(any) default…
dobbs
  • 1,089
  • 6
  • 22
  • 45
1
vote
1 answer

Nomad Connect Two docker Containers

I am having trouble establishing communication between two docker containers via nomad. Containers are in the same task group but still unable to reach each other. Even when using NOMAD_ADDR_ environment variable. Can anyone help in this regard? I…
Zeeshan
  • 21
  • 4
1
vote
1 answer

Packer Variable (default) Syntax

I have inherited a Packer project that has an odd syntax in the "default" field of the variable definitions. I have a pkrvars file that I am assigning the variables in, using the variable name block (e.g sshkey, subscription_id, etc). What is the…
Emeria
  • 168
  • 1
  • 14
1
vote
1 answer

Terraform variables defaults and description for nested values

Is there a option to set a defaults and description for nested variables in terraform? Example: variable "example_page_rule"{ type = list(object({ level = string, tags = string, prefix = string }))…
1
vote
2 answers

Overwrite attribute in terraform variable object

I need to pass a variable that contains an object with multiple variables. Is it any way to override one of these attributes where parsing it? For example: global = { region = "eu-central-1" account_id = "9555555" app_port = 8080 domain =…
Guel135
  • 750
  • 7
  • 26
1
vote
1 answer

How to rename a dynamic block in terraform

I'm trying to use a dynamic block in a kubernetes_ingress resource. The dynamic block is for the spec.rule.http.path block. Unfortunately, I am trying to dynamically create a path block which causes issues as path appears to be a reserved word. Is…
James
  • 615
  • 1
  • 4
  • 22
1
vote
1 answer

How to Export HCL of Imported Resource for Editing

We are using Terraform to make scaling our New Relic dashboards easier and more uniform. This is because we will need to recreate all of our existing dashboards (currently a few dozen) each time we spin up a new client and/or a new product region.…
1
vote
1 answer

Can this unreadable terraform code-snippet be made more presentable?

I have a code snippet that sets the node pool name for a GKE cluster, it is very much unreadable. I would appreciate any help in making it more presentable and easy to understand what is happening. output "test" { value =…
hdhruna
  • 865
  • 6
  • 15
1
vote
1 answer

Terraform Module Source: Target Latest Release and specific file in GitHub

In a project I am working on we have a module like this: module "module-name" { source = "https://github.com/some/repo/releases/download/v0.1.7/filename.zip" ... } Currently when ever there is a release in https://github.com/some/repo/ we…
Cogito Ergo Sum
  • 592
  • 6
  • 18
1
vote
0 answers

Need a way to get all private IPs for Consul's retry_join without hardcoding it in the config file

I'm trying to use terraform to set up consul servers on Hetzner Cloud with private network. Since Hetzner doesn't support auto-join yet, is it possible to use go-sockaddr's GetPrivateIPs to get all private IPs available for retry_join in the config…
RedGiant
  • 4,444
  • 11
  • 59
  • 146
1
vote
1 answer

Is timestamp function not supported in HCL2?

I am trying to get the current day and put in a local locals { current_day = formatdate("DD/MM/YYYY", timestamp()) } but a I get this error Call to unknown function; There is no function named "timestamp". Is timestamp function not supported in…
Kais
  • 99
  • 12
1
vote
1 answer

Why packer is returning the error "typing a boot command (code, down) 82, false" while trying to build a centos7 vm for Vsphere?

Does anyone know how could I troubleshoot this booting packer error: Error running boot command: error typing a boot command (code, down) 82, false: ServerFaultCode: Permission to perform this operation was denied. I am trying to build a centos7 vm…