Difference between revisions of "Terraform types"

From wikieduonline
Jump to navigation Jump to search
Line 34: Line 34:
 
}
 
}
 
</pre>
 
</pre>
 +
 +
 +
== Object list ==
 +
variable "Your_Var_Name" {
 +
  type = [[list]]
 +
  default = [{
 +
    "your_var_1" = "your_value_1"
 +
    "your_var_2" = "your_value_1"
 +
    "your_var_3" = "your_value_1"
 +
  }]
 +
}
  
 
== Related terms ==
 
== Related terms ==

Revision as of 11:49, 8 September 2021


  • string: a sequence of Unicode characters representing some text, like "hello".
  • number: a numeric value. The number type can represent both whole numbers like 15 and fractional values like 6.283185.
  • bool: a boolean value, either true or false. bool values can be used in conditional logic.
  • list or tuple: a sequence of values, like ["us-west-1a", "us-west-1c"]. Elements in a list or tuple are identified by consecutive whole numbers, starting with zero.
  • map or object: a group of values identified by named labels, like {name = "Mabel", age = 52}.

Example:

 type        = list(string)
 default     = []

List example: ["us-west-1a", "us-west-1c"]


Map/Object example

{
  name = "John"
  age  = 52
}
variable "amis" {
 type = "map"
 default = {
   "us-east-1" = "ami-b374d5a5"
   "us-west-2" = "ami-4b32be2b"
 }
}


Object list

variable "Your_Var_Name" {
  type = list
  default = [{
    "your_var_1" = "your_value_1"
    "your_var_2" = "your_value_1"
    "your_var_3" = "your_value_1"
  }]
}

Related terms

See also

Advertising: