feat: handle .terraform cache
All checks were successful
semantic-release / release (push) Successful in 30s
All checks were successful
semantic-release / release (push) Successful in 30s
This commit is contained in:
43
plan/action.yml
Normal file
43
plan/action.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Terraform Plan
|
||||
description: Run terraform plan and publish the plan as an artifact named "terraform-plan"
|
||||
|
||||
inputs:
|
||||
working-directory:
|
||||
description: Directory containing the Terraform configuration
|
||||
required: false
|
||||
default: "."
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@5e8dbf3c6d9deaf4193ca7a8fb23f2ac83bb6c85 # v4.0.0
|
||||
|
||||
- name: Cache Terraform providers
|
||||
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
|
||||
with:
|
||||
path: ${{ inputs.working-directory }}/.terraform
|
||||
key: terraform-${{ hashFiles(format('{0}/.terraform.lock.hcl', inputs.working-directory)) }}
|
||||
restore-keys: terraform-
|
||||
|
||||
- name: Terraform Init
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
run: terraform init
|
||||
|
||||
- name: Terraform Validate
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
run: terraform validate
|
||||
|
||||
- name: Terraform Plan
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
run: terraform plan -out=tfplan
|
||||
|
||||
- name: Upload plan artifact
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
with:
|
||||
name: terraform-plan
|
||||
path: ${{ inputs.working-directory }}/tfplan
|
||||
retention-days: 5
|
||||
Reference in New Issue
Block a user