IT 3110 : DevOps Automation

Terraform 3


How terraform applies a configuration


Configuration Meta-argument


Configuration Meta-argument


Configuration Meta-argument


For_each example

    resource "azurerm_resource_group" "rg" {
      for_each = {
        a_group = "eastus"
        another_group = "westus2"
      }
      name     = each.key
      location = each.value
    }

Input variables


Input variables

    variable "image_id" {
      type        = string
      description = "The id of the machine image (AMI) to use for the server."
    }

Input variables

    variable "mytype" {
      type = string
      description = "The type of instance to create"
    }

    resource "aws_instance" "example" {
      ami           = "ami-0817d428a6fb68645"
      instance_type = var.mytype
    }

Input variables

The previous example will prompt for the variable value at runtime. You can also:


Output values


Terraform Cloud

https://app.terraform.io/app/getting-started/example