terraform validate check in a Terraform configuration?Choose the correct description of what terraform validate does when run in a Terraform project directory.
Think about whether terraform validate needs to connect to the cloud or create resources.
terraform validate checks the syntax and internal consistency of the Terraform files locally. It does not contact any cloud provider or create resources. It helps catch syntax errors before planning or applying.
terraform validate detect?Given the following Terraform snippet, what error will terraform validate report?
resource "aws_instance" "example" {
ami = "ami-123456"
instance_type = "t2.micro"
invalid_attribute = "value"
}Check if all attributes used are supported by the resource type.
terraform validate detects unsupported or misspelled attributes in resource blocks. Here, 'invalid_attribute' is not valid for 'aws_instance'.
terraform validate for this configuration?Consider this Terraform configuration snippet:
variable "region" {
type = string
}
provider "aws" {
region = var.region
}Run terraform validate without setting any variable values. What will happen?
Think about whether terraform validate requires variable values to be set.
terraform validate checks syntax and internal consistency only. It does not require variable values to be set, so validation passes even if variables are unset.
terraform validate limitation affects security checks?Which security-related issue terraform validate cannot detect?
Consider what terraform validate checks and what it does not.
terraform validate checks syntax and structure but does not enforce security policies or detect misconfigurations that violate security best practices.
terraform validate succeed but terraform plan fail?Choose the best explanation for why terraform validate can pass but terraform plan fails with an error.
Think about the difference between syntax checking and planning.
terraform validate only checks syntax and internal consistency locally. terraform plan contacts cloud providers and checks resource states, so it can fail due to connectivity or configuration issues not caught by validation.