Skip to content

Instantly share code, notes, and snippets.

@diogoaurelio
Last active March 21, 2021 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diogoaurelio/81fb0b1f4bcb927dd3f9e046ce9a9427 to your computer and use it in GitHub Desktop.
Save diogoaurelio/81fb0b1f4bcb927dd3f9e046ce9a9427 to your computer and use it in GitHub Desktop.
terraform_validate_resources
# terraform validate will catch typo in resource reference
resource "aws_s3_bukcet" "wrong_resource" {
name = "my-bucket"
}
# terraform validate will catch wrong CIDR
resource "aws_vpc" "default" {
cidr_block = "0.0.0.0/0"
}
resource "aws_instance" "web" {
# .. however, non existing instance type is not caught by terraform validate
instance_type = "t200.micro"
ami = "ami-0db61e5fa6d1a815a"
vpc_security_group_ids = [aws_security_group.default.id]
subnet_id = aws_subnet.default.id
provisioner "remote-exec" {
inline = [
"sudo apt-get -y update",
"sudo apt-get -y install nginx",
"sudo service nginx start",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment