Last active
March 21, 2021 16:25
-
-
Save diogoaurelio/81fb0b1f4bcb927dd3f9e046ce9a9427 to your computer and use it in GitHub Desktop.
terraform_validate_resources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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