Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Terraform Security Scanning Tools Setup
📖 Scenario: You are working as a cloud engineer responsible for ensuring your Terraform infrastructure code is secure before deployment. You want to integrate a security scanning tool to automatically check your Terraform files for common security issues.
🎯 Goal: Build a Terraform configuration that sets up a security scanning tool integration using a local-exec provisioner to run terraform-compliance checks on your Terraform files.
📋 What You'll Learn
Create a Terraform resource block for a null_resource named security_scan.
Add a local-exec provisioner inside the resource to run the command terraform-compliance -p plan.out -f features/.
Define a variable scan_command with the exact command string to run the security scan.
Add a depends_on attribute to the resource to depend on terraform_plan resource.
💡 Why This Matters
🌍 Real World
Security scanning tools help catch misconfigurations and vulnerabilities in Terraform code before deployment, reducing risks in cloud infrastructure.
💼 Career
Cloud engineers and DevOps professionals use Terraform security scanning tools to ensure infrastructure as code is safe and compliant with best practices.
Progress0 / 4 steps
1
Create a null_resource for security scanning
Create a Terraform resource block named security_scan of type null_resource.
Terraform
Hint
Use resource "null_resource" "security_scan" { } to start.
2
Define a variable for the scan command
Add a Terraform variable named scan_command with the default value "terraform-compliance -p plan.out -f features/".