Terraform lookup function

From wikieduonline
Revision as of 20:27, 5 April 2023 by Welcome (talk | contribs)
Jump to navigation Jump to search

Terraform lookup function retrieves the value of a single element from a map, given its key.

lookup(map, key, default)

Examples

variable "candy_list" {
  type = list(string)
  default = ["snickers", "kitkat", "reeces", "m&ms"]
}
 
output "give_me_candy" {
  value = "${lookup(var.candy_list, 2)}"
}

Related

See also

Advertising: