Terraform makes infrastructure provisioning repeatable, consistent, and easier to manage.
But there is an important distinction that infrastructure teams should keep in mind:
A Terraform configuration can be syntactically valid and still introduce serious security risks.
terraform fmt helps keep configurations properly formatted, and terraform validate checks whether the configuration is structurally valid. Neither one is designed to perform a complete security review of your infrastructure.
Here are a few examples worth checking before deploying.
1. Security groups exposing sensitive ports
Consider this Terraform configuration:
resource "aws_security_group_rule" "ssh" { type = "ingress" from_port = 22 to_port = 22 protocol = "tcp" cidr_blocks = [ "0.0.0.0/0" ] security_group_id = aws_security_group . example .…