Questions tagged [terraform-variables]

6 questions
8
votes
4 answers

How to define default value of one variable based on other variables in Terraform variable.tf file?

For example, in variable.tf file we have this code: variable "variable1" { type = string default = "ABC" } variable "variable2" { type = string default = "DEF" } variable "variable3" { type = string default =…
Venki
  • 225
  • 4
  • 14
1
vote
1 answer

Terraform - add key,value to map based on a conditional

I'm trying to create a map in locals where a key is created dynamically based on the value of another variable, and can't find a functional way of doing this in Terraform. The map contains subnet configuration parameters, in the format: …
0
votes
1 answer

Do I need interpolation syntax when assigning a variable to a resource argument?

In the Terraform docs, I sometimes stumble upon examples like this: resource "vsphere_folder" "folder" { path = "terraform-test-folder" type = "vm" datacenter_id = "${data.vsphere_datacenter.dc.id}" } where they use…
0
votes
1 answer

Is it possible to use variables in azure pipelines yml that extends from template(which contains variables)?

I would like to use variables in my Azure pipeline yaml to be able to map some values between azure and terraform. Also using extends in my yaml referring to a template in another repo in the project(it contains variables).Now I am getting error in…
0
votes
2 answers

How do I add a variable to a Terraform template heredoc prefixed with a literal percent: %${variable}

I am trying to use a Terraform template file to create a sudoers file on a Linux server. I am passing in the name of a group that should be granted sudo permission as a variable to the template. As per the syntax of the sudoers file, groups need to…
Charlie Joynt
  • 4,411
  • 1
  • 24
  • 46
-1
votes
1 answer

Terraform local variable with map

I want to create this metric_info variable using the values of the metric_config variable I tried some ways but without success. The reported error is there below. Maybe bringing the metrics out further like this metric_config = [ + metrics = { and…