Skip to content

Commit

Permalink
trying a check
Browse files Browse the repository at this point in the history
  • Loading branch information
proquickly committed Nov 6, 2024
1 parent 21e178e commit 89651a3
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy EC2 with Terraform
name: Terraform

on:
push:
Expand All @@ -7,21 +7,34 @@ on:
pull_request:
branches:
- main

jobs:
terraform:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3

- name: Configure AWS Credentials
uses: hashicorp/setup-terraform@v1

- name: Echo AWS Access Key (Debug Step)
run: echo ${{ secrets.AWS_ACCESS_KEY_ID }}

- name: Verify AWS Secrets Presence (Debug Step)
run: |
if [ -z "${{ secrets.AWS_ACCESS_KEY_ID }}" ]; then
echo "AWS_ACCESS_KEY_ID secret is not set"
exit 1
fi
if [ -z "${{ secrets.AWS_SECRET_ACCESS_KEY }}" ]; then
echo "AWS_SECRET_ACCESS_KEY secret is not set"
exit 1
fi
echo "AWS secrets are set"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -31,16 +44,16 @@ jobs:
- name: Verify AWS credentials
run: aws sts get-caller-identity

- name: Terraform Init
- name: Initialize Terraform
run: terraform init
working-directory: terraform

- name: Terraform Plan
- name: Plan Terraform
run: terraform plan -out=tfplan
working-directory: terraform

- name: Upload plan file
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: tfplan
path: terraform/tfplan

0 comments on commit 89651a3

Please sign in to comment.