taking off unused modules and change the pipeline #16
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
name: Terraform CI/CD | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
- main | ||
jobs: | ||
# validate: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v2 | ||
# - name: Set up Terraform | ||
# uses: hashicorp/setup-terraform@v2 | ||
# with: | ||
# terraform_version: latest | ||
# - name: Terraform Init | ||
# run: terraform init -reconfigure -upgrade | ||
# - name: Terraform Validate | ||
# run: terraform validate | ||
plan: | ||
runs-on: ubuntu-latest | ||
needs: validate | ||
steps: | ||
- name: terraform logs to trace | ||
shell: bash | ||
run: echo "Terraform logs" | export TF_LOG=TRACE | ||
continue-on-error: true | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_version: latest | ||
- name: Terraform Plan | ||
run: terraform plan -out=plan | ||
- name: Archive Plan | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: plan | ||
path: plan | ||
if-no-files-found: error | ||
# apply: | ||
# runs-on: ubuntu-latest | ||
# needs: plan | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v2 | ||
# - name: Set up Terraform | ||
# uses: hashicorp/setup-terraform@v2 | ||
# with: | ||
# terraform_version: latest | ||
# - name: Terraform Apply | ||
# run: terraform apply --auto-approve plan | ||
# destroy: | ||
# runs-on: ubuntu-latest | ||
# needs: apply | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v2 | ||
# - name: Set up Terraform | ||
# uses: hashicorp/setup-terraform@v2 | ||
# with: | ||
# terraform_version: latest | ||
# - name: Terraform Destroy | ||
# run: terraform apply -destroy --auto-approve |