mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
name: "Terraform Plan Shared Config"
|
|
description: "Plans shared Terraform config for Lambdas"
|
|
|
|
inputs:
|
|
working_directory:
|
|
description: "Directory containing Terraform config"
|
|
required: true
|
|
aws-access-key-id:
|
|
description: "AWS access key"
|
|
required: true
|
|
aws-secret-access-key:
|
|
description: "AWS secret key"
|
|
required: true
|
|
aws-region:
|
|
description: "AWS region"
|
|
required: true
|
|
lambda-image-tag:
|
|
description: "Tag of the Lambda image (e.g., GitHub SHA)"
|
|
required: false
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
with:
|
|
aws-access-key-id: ${{ inputs.aws-access-key-id }}
|
|
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
|
|
aws-region: ${{ inputs.aws-region }}
|
|
|
|
- name: Setup Terraform
|
|
uses: hashicorp/setup-terraform@v3
|
|
|
|
- name: Terraform Init
|
|
working-directory: ${{ inputs.working_directory }}
|
|
shell: bash
|
|
run: terraform init -reconfigure
|
|
|
|
- name: Terraform Plan
|
|
working-directory: ${{ inputs.working_directory }}
|
|
shell: bash
|
|
run: |
|
|
if [ -n "${{ inputs.lambda-image-tag }}" ]; then
|
|
terraform plan -out=tfplan -var="lambda_image_tag=${{ inputs.lambda-image-tag }}"
|
|
else
|
|
terraform plan -out=tfplan
|
|
fi
|
|
|
|
- name: Terraform Apply
|
|
working-directory: ${{ inputs.working_directory }}
|
|
shell: bash
|
|
run: terraform apply -auto-approve tfplan
|