Skip to content

updated tf

updated tf #20

Workflow file for this run

on:
push:
branches:
- main
paths:
- challenge5/**
permissions:
id-token: write
contents: read
jobs:
terraform:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./challenge5
steps:
- name: " Github checkout"
uses: actions/checkout@v3
with:
sparse-checkout: challenge5
- name: "configure aws"
uses: aws-actions/configure-aws-credentials@v1.7.0
with:
role-to-assume: ${{ secrets.challenge5_arn }}
aws-region: "us-east-1"
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: "building image"
# uses: docker/build-push-action@v5
# with:
# context: .
# push: true
# tags: rajrishab/challenge5:${{ github.sha }}
# - name: "Updating config"
# run: |
# tag=rajrishab/challenge5:${{ github.sha }}
# sed -i "s/IMAGE_TAG/$tag/" ./kubernetes/deployment.yaml
- name: "Terraform setup"
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.5.7
- name: "terraform init"
run: terraform init
- name: "Terraform format"
run: terraform fmt -check
- name: "Terraform validate"
run: terraform validate
- name: "Terraform plan"
run: terraform plan
- name: "terraform apply"
run: terraform apply --auto-approve
- name: "update kubeconfig"
run: aws eks update-kubeconfig --name mycluster --region us-east-1
- name: "applying config"
run: |
kubectl get nodes
kubectl apply -f kubernetes/
# - name: "delete cluster"
# run: terraform destroy --auto-approve