Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Cloud/Terraform First Class Expressions

January 16, 2020

Terraform First Class Expressions

If you were running the older versions of Terraform, with release 0.12 and higher, there will be certain parts of your script that are no longer supported. Terraform uses expressions for dynamic configuration and dependencies. First-class expressions enable variables and operations to be performed outside of strings. In Terraform 0.11 and earlier all expressions were required to be part of interpolations in existing strings, such as “${var.foo}.

In Terraform 0.11.

resource "aws_instance" "example" {
  ami           = "${var.ami}"
  instance_type = "${var.instance_type}"
}

resource "aws_instance" "example" { ami = "${var.ami}" instance_type = "${var.instance_type}" }

In Terraform 0.12.

resource "aws_instance" "example" {
  ami           = var.ami
  instance_type = var.instance_type
}

resource "aws_instance" "example" { ami = var.ami instance_type = var.instance_type }

Gone are quotes, curly braces and the $ sign.

Filed Under: Cloud Tagged With: 0.11, 0.12, aws, first class expressions, interpolations, terraform

About Me

I'm Ulysses, a Cloud Engineer at Cardinal Health based in Columbus, Ohio. I’m a certified AWS Solutions Architect. This website is my way of documenting the things I have learned in the Cloud. When off the grid, I enjoy riding my electric skateboard. I have surfed, snowboarded and played the saxophone in the past. I hope you will find this site helpful. It's powered by WordPress and hosted in AWS LightSail.

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021