Original article
Terraform code quality - CloudSkiff

Terraform code quality starts by the basics with Terraform Validate.

Terraform validate is a subcommand in Terraform that will only address structure and coherence, which means that an obviously bad code like this one will be perfectly right in the eyes of Terraform :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
provider "aws" {
  region = "BOGUS"
}

resource "aws_bogus_resource" "vm" {
  ami                    = "BOGUS"
  instance_type          = "BOGUS_TOO"
  vpc_security_group_ids = ["123456789"]
  key_name               = "BOGUS"
  tags = {
    Name      = "CNCF London Meetup"
  }
}
1
terraform validate
1
Success! The configuration is valid.