Terraform
by HashiCorp
Infrastructure as Code (IaC) tool for provisioning and managing cloud resources with state management and secrets handling
Authoritative Sources
Key guidance documents from authoritative organizations. Click to view the original source.
NIST SSDF PS.3.1: "Store all forms of code—including source code, executable code, and configuration-as-code—based on the principle of least privilege so that only authorized personnel, tools, services, etc. have access." PO.3.2: "Collect, safeguard, maintain, and share provenance data for all components of each software release." PW.6.1: "Create secure configurations for software development processes, tools, and infrastructure, including at least secure configuration of source code repository, security features of the development IDEs, and secrets management." Terraform state files should be secured following SSDF PS.3.1 principles.
Configuration Examples(2)
Official HashiCorp guidance: "Terraform state and plan files contain detailed information about your infrastructure, including resource attributes and metadata that can contain sensitive values. Treat your state file as sensitive data by excluding it from Git workflows and following security recommendations."
Configuration Examples(4)
CIS provides benchmarks for cloud platforms (AWS, Azure, GCP) that can be enforced through Terraform configurations. Terraform enables consistent deployment of CIS-compliant infrastructure.
Configuration Examples(2)
SOC 2 CC8.1: "The entity authorizes, designs, develops or acquires, configures, documents, tests, approves, and implements changes to infrastructure, data, software, and procedures to meet its objectives." Terraform provides Infrastructure as Code with version control, plan/apply workflows, and state management that directly support CC8.1 change management requirements. Source: AICPA Trust Services Criteria.
ISO 27001:2022 A.8.9: "Configurations, including security configurations, of hardware, software, services and networks shall be established, documented, implemented, monitored and reviewed." Terraform enables declarative infrastructure configuration management with version control and drift detection, implementing A.8.9 requirements. Source: ISO/IEC 27001:2022 Annex A.
Verification Commands
Commands and queries for testing and verifying security configurations.
terraform init -backend-config="backend.hcl" terraform validate terraform plan -var-file="secrets.tfvars" -out=plan.tfplan terraform apply -auto-approve plan.tfplan terraform show -json | jq ".values.root_module.resources[].values | keys" terraform state list tfsec . --format json checkov -d . --framework terraform --output json trivy config --severity HIGH,CRITICAL . terraform plan -detailed-exitcode terraform state rm aws_db_instance.sensitive terraform import aws_s3_bucket.example bucket-name Related Controls
Security controls from various frameworks that relate to Terraform.