learn-terraform

Course outlines for learning terraform.

View the Project on GitHub robertdebock/learn-terraform

Assignment examples

Solution to example 1

resource "azurerm_resource_group" "example" {
  count    = 2
  name     = "example-${count.index}"
  location = "West Europe"
}

Solution to example 2

resource "azurerm_resource_group" "example" {
  for_each = toset( ["westeurope", "easteurope"] )
  name     = "example-${each.value}"
  location = each.value
}

Solution to example 3

resource "azurerm_resource_group" "example" {
  for_each = {
    my_first_resource_group = "westeurope"
    my_second_resource_group = "easteurope"
  }
  name     = each.key
  location = each.value
}