slowbro/gitlab-pipeline icon
public
Published on 3/11/2025
GitLab CI/CD Pipeline Creation

GitLab CI pipeline setup for Terraform to AWS

Prompts
GitLab CI/CD Terraform Deployment
GitLab CI pipeline setup for Terraform to AWS
Provide a complete GitLab CI/CD pipeline example that meets the following requirements:

Pipeline Requirements:
- Stages: validate, plan, manual approval, apply
- Validate Terraform syntax and format (`terraform validate`, `terraform fmt`)
- Securely handle AWS credentials without hardcoding secrets
- Generate and persist Terraform plans as job artifacts
- Implement manual approval gate before applying changes
- Ensure pipeline follows security best practices

Documentation & Explanation:
- Explain each stage and its purpose
- Highlight critical security considerations
- Provide inline comments in pipeline code
- Suggest best practices and potential improvements

The user has provided the following details: