-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified: .github/workflows/terraform.yml
- Loading branch information
obervinov
committed
Dec 26, 2023
1 parent
7960a52
commit c4f7cbe
Showing
1 changed file
with
12 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,32 @@ | ||
--- | ||
name: Plan and Apply Terraform | ||
|
||
on: [workflow_call] # yamllint disable-line rule:truthy | ||
on: # yamllint disable-line rule:truthy | ||
workflow_call: | ||
inputs: | ||
TF_WORKSPACE: | ||
description: 'Terraform workspace directory' | ||
required: true | ||
type: string | ||
|
||
|
||
jobs: | ||
terraform-fmt-template: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Terraform fmt | ||
run: | | ||
cd ${{ inputs.TF_WORKSPACE }} | ||
pwd | ||
echo ${{ inputs.TF_WORKSPACE }} | ||
env | ||
cd ${{ github.event.inputs.TF_WORKSPACE }} | ||
terraform fmt -recursive -check -diff | ||
terraform-docs-template: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Terraform docs | ||
run: | | ||
cd ${{ inputs.TF_WORKSPACE }} | ||
cd ${{ github.event.inputs.TF_WORKSPACE }} | ||
terraform-docs markdown . > README.md | ||
terraform-plan-template: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Terraform init | ||
run: | | ||
cd ${{ inputs.TF_WORKSPACE }} | ||
terraform init --upgrade | ||
- name: Terraform plan | ||
run: | | ||
cd ${{ inputs.TF_WORKSPACE }} | ||
terraform plan -compact-warnings -detailed-exitcode ${{ inputs.TF_EXTRA_ARGS }} | ||
terraform-apply-template: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Terraform init | ||
run: | | ||
cd ${{ inputs.TF_WORKSPACE }} | ||
terraform init --upgrade | ||
- name: Terraform apply | ||
run: | | ||
cd ${{ inputs.TF_WORKSPACE }} | ||
terraform apply -auto-approve -compact-warnings ${{ inputs.TF_EXTRA_ARGS }} |