71 lines
1.8 KiB
YAML
71 lines
1.8 KiB
YAML
name: SES - juntekim.com [Simple Email Service]
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "aws_environment/ses-juntekim/**"
|
|
|
|
env:
|
|
TF_VERSION: "1.6.6"
|
|
WORKING_DIR: "aws_environment/ses-juntekim"
|
|
|
|
jobs:
|
|
terraform-plan:
|
|
name: Terraform Plan - SES
|
|
runs-on: mealcraft-runners
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Terraform
|
|
uses: hashicorp/setup-terraform@v3
|
|
with:
|
|
terraform_version: ${{ env.TF_VERSION }}
|
|
|
|
- name: Install AWS CLI v2
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y unzip curl
|
|
|
|
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
|
unzip awscliv2.zip
|
|
sudo ./aws/install
|
|
|
|
aws --version
|
|
|
|
- name: Verify AWS identity
|
|
run: aws sts get-caller-identity
|
|
|
|
- name: Terraform Init
|
|
working-directory: ${{ env.WORKING_DIR }}
|
|
run: terraform init
|
|
|
|
- name: Terraform Validate
|
|
working-directory: ${{ env.WORKING_DIR }}
|
|
run: terraform validate
|
|
|
|
- name: Terraform Plan
|
|
id: plan
|
|
working-directory: ${{ env.WORKING_DIR }}
|
|
run: terraform plan -input=false -out=tfplan
|
|
|
|
- name: Comment Plan on PR
|
|
uses: actions/github-script@v6
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const fs = require('fs');
|
|
const planOutput = `${{ steps.plan.outputs.stdout }}`;
|
|
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: `## Terraform Plan - SES\n\n\`\`\`\n${planOutput}\n\`\`\``
|
|
});
|
|
continue-on-error: true
|