Skip to main content

Below is an example of a loop. We use the content block of terraform, documented here: https://www.terraform.io/docs/language/expressions/dynamic-blocks.html

  • In the variables.tf file:
variable "list_to_iterate" {
    description = "A list to iterate on"
    type = list(string)
    default = []
}
  • In the main.tf file:
resource "resource" "local_given_name" {
    dynamic "block" {
    for_each = var.list_to_iterate
        content {
        block_arg = local_given_name.value
        }
    } 
}
Close Menu

WHERE TO FIND US


PARIS

Bâtiment Crisco Duo
7 avenue de la Cristallerie
92310 Sèvres, France

NANTES

Centre d’affaires Euptouyou
4 rue Edith Piaf Immeuble Asturia C
44800 Saint-Herblain, France

PHONE

+33 1 46 48 26 00

EMAIL

[email protected]