Refactor Terraform configuration for MongoDB deployment: modularize E… #13
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Terraform CI | |
| on: | |
| pull_request: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'terraform/**' | |
| - '.github/workflows/ci.yml' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| AWS_REGION: us-west-2 | |
| TERRAFORM_VERSION: 1.6.0 | |
| jobs: | |
| validate-staging: | |
| name: Validate Staging | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: terraform/stacks/staging | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_SECRET_ACCESS_ID }} # DO NOT CHANGE THIS LINE | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # DO NOT CHANGE THIS LINE | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: ${{ env.TERRAFORM_VERSION }} | |
| - name: Terraform Format Check | |
| run: terraform fmt -check | |
| - name: Terraform Init | |
| run: terraform init | |
| - name: Terraform Validate | |
| run: terraform validate | |
| - name: Terraform Plan | |
| run: terraform plan -var-file=terraform.tfvars -no-color | |
| validate-production: | |
| name: Validate Production | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: terraform/stacks/production | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_SECRET_ACCESS_ID }} # DO NOT CHANGE THIS LINE | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # DO NOT CHANGE THIS LINE | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: ${{ env.TERRAFORM_VERSION }} | |
| - name: Terraform Format Check | |
| run: terraform fmt -check | |
| - name: Terraform Init | |
| run: terraform init | |
| - name: Terraform Validate | |
| run: terraform validate | |
| - name: Terraform Plan | |
| run: terraform plan -var-file=terraform.tfvars -no-color |