Optimized for: Gemini / ChatGPT / Claude
Advanced AI Prompt for Terraform IaC Validation and Apply
Use this engineered prompt to drastically optimize your workflow and output.
Required Variables
- ✦
[TF_VERSION] - ✦
[TF_WORKING_DIR] - ✦
[BACKEND_CONFIG]
terraform-iac-validation-apply.txt
Develop a GitHub Actions workflow for managing Infrastructure as Code with Terraform version [TF_VERSION]. The workflow must: 1) On Pull Request, run 'terraform init', 'terraform validate', and 'terraform plan' inside [TF_WORKING_DIR]. 2) Post the plan output as a comment on the PR. 3) On push to main, run 'terraform apply' with an auto-approve flag. 4) Use a remote backend defined in [BACKEND_CONFIG]. 5) Implement a security scan on the HCL files using 'tfsec'.
Example Output
"A GitOps-style YAML that integrates Terraform CLI with PR commenting and security linting for infrastructure changes."