Skip to content

removed reduntant files #68

removed reduntant files

removed reduntant files #68

name: Terraform Kubernetes Workflow
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
tfpath:
description: 'TF Code Path'
required: false
default: 'kubernetes'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
tf_code_check:
name: Terraform Validation and Build
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
if: ${{ inputs.tfpath }}
steps:
- name: Checkout Code
uses: actions/[email protected]
- name: Install Minikube for GitHub Actions
uses: medyagh/[email protected]
- name: Install Kubectl tool for GitHub Actions
uses: Azure/setup-kubectl@v3
- name: Setup Terraform CLI
uses: hashicorp/[email protected]
- name: Terraform init and velidate and plan
run: |
echo `pwd`
echo "tfpath ${{ github.event.inputs.tfpath }}"
echo "** Running Terraform Init**"
terraform init
echo "** Running Terraform Validate**"
terraform validate
echo "** Running Terraform Plan**"
terraform plan
working-directory: ${{ github.event.inputs.tfpath }}
- name: Terraform Apply
run: |
echo "** Running Terraform Apply**"
terraform apply -auto-approve
working-directory: ${{ github.event.inputs.tfpath }}
- name: Verify Kubernetes Deployment
run: |
echo "** kubectl get deployment **"
kubectl get deployment -n k8s-ns-by-tf
- name: Terraform Destroy
run: |
echo "** Running Terraform Destroy**"
terraform plan -destroy
working-directory: ${{ github.event.inputs.tfpath }}