From 0ab66d26e97d77a0c0f6606b094c05e159212de1 Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 13:35:30 +0530 Subject: [PATCH 01/15] Update --- terraform/terraform.tf | 4 ++-- terraform/variables.tf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index 67b75c673..b83b5177e 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -27,9 +27,9 @@ terraform { } backend "s3" { - bucket = "gitopsterrastate" + bucket = "gk8s-state99" key = "terraform.tfstate" - region = "us-east-2" + region = "us-east-1" } required_version = "~> 1.6.3" diff --git a/terraform/variables.tf b/terraform/variables.tf index a41d982a0..6dd7e250b 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -1,7 +1,7 @@ variable "region" { description = "AWS region" type = string - default = "us-east-2" + default = "us-east-1" } variable "clusterName" { From f47f46cfab5d305b13fc931308498a18811cf3ab Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 13:58:53 +0530 Subject: [PATCH 02/15] stating workflow --- terraform/.github/workflows/terraform.yml | 61 +++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 terraform/.github/workflows/terraform.yml diff --git a/terraform/.github/workflows/terraform.yml b/terraform/.github/workflows/terraform.yml new file mode 100644 index 000000000..ba4c3066e --- /dev/null +++ b/terraform/.github/workflows/terraform.yml @@ -0,0 +1,61 @@ +name: "Vprofile IAC" +on: + push: + branches: + - main + - stage + paths: + - terraform/** + pull_request: + branches: + - main + paths: + - terraform/** + +env: + # Credentials for deployment to AWS + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # S3 bucket for the Terraform state + BUCKET_TF_STATE: ${{ secrets.BUCKET_TF_STATE}} + AWS_REGION: us-east-1 + EKS_CLUSTER: kitops-eks + +jobs: + terraform: + name: "Apply terraform code changes" + runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ./terraform + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Setup Terraform with specified version on the runner + uses: hashicorp/setup-terraform@v2 + #with: + # terraform_version: 1.6.3 + + - name: Terraform init + id: init + run: terraform init -backend-config="bucket=$BUCKET_TF_STATE" + + - name: Terraform format + id: fmt + run: terraform fmt -check + + - name: Terraform validate + id: validate + run: terraform validate + + - name: Terraform plan + id: plan + run: terraform plan -no-color -input=false -out planfile + continue-on-error: true + + - name: Terraform plan status + if: steps.plan.outcome == 'failure' + run: exit 1 From e7abc3e288fb97c52a92a7968ee6da86a4c446c1 Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:01:49 +0530 Subject: [PATCH 03/15] fgf --- terraform/terraform.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index b83b5177e..913a25bcf 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -36,4 +36,4 @@ terraform { } ## ## -## +### From 7f50ae0bd4b4e0019ac9abc22c4584a883639192 Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:05:26 +0530 Subject: [PATCH 04/15] test1 --- terraform/terraform.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index 913a25bcf..427e5993e 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -34,6 +34,6 @@ terraform { required_version = "~> 1.6.3" } -## +### ## ### From 2a2c246855659f99b06bbabdf68027dadd53905c Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:15:43 +0530 Subject: [PATCH 05/15] updated workflow --- terraform/.github/workflows/terraform.yml | 102 ++++++++++++---------- 1 file changed, 55 insertions(+), 47 deletions(-) diff --git a/terraform/.github/workflows/terraform.yml b/terraform/.github/workflows/terraform.yml index ba4c3066e..e07d96fce 100644 --- a/terraform/.github/workflows/terraform.yml +++ b/terraform/.github/workflows/terraform.yml @@ -1,61 +1,69 @@ name: "Vprofile IAC" + on: push: branches: - main - stage - paths: - - terraform/** + paths: + - 'terraform/**' pull_request: branches: - main paths: - - terraform/** + - 'terraform/**' env: - # Credentials for deployment to AWS - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # S3 bucket for the Terraform state - BUCKET_TF_STATE: ${{ secrets.BUCKET_TF_STATE}} - AWS_REGION: us-east-1 - EKS_CLUSTER: kitops-eks + TF_VAR_region: us-east-1 + EKS_CLUSTER: kitops-eks jobs: - terraform: - name: "Apply terraform code changes" - runs-on: ubuntu-latest - defaults: - run: - shell: bash - working-directory: ./terraform - - steps: - - name: Checkout source code - uses: actions/checkout@v4 - - - name: Setup Terraform with specified version on the runner - uses: hashicorp/setup-terraform@v2 - #with: - # terraform_version: 1.6.3 - - - name: Terraform init - id: init - run: terraform init -backend-config="bucket=$BUCKET_TF_STATE" - - - name: Terraform format - id: fmt - run: terraform fmt -check - - - name: Terraform validate - id: validate - run: terraform validate - - - name: Terraform plan - id: plan - run: terraform plan -no-color -input=false -out planfile - continue-on-error: true - - - name: Terraform plan status - if: steps.plan.outcome == 'failure' - run: exit 1 + terraform: + name: "Terraform EKS Infra" + runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ./terraform + + steps: + - name: Checkout source code + id: checkout + uses: actions/checkout@v4 + + - name: Setup Terraform + id: setup_terraform + uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.6.3 + + - name: Configure AWS credentials + id: aws_creds + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Terraform Init + id: init + run: terraform init -backend-config="bucket=${{ secrets.BUCKET_TF_STATE }}" \ + -backend-config="region=us-east-1" + + - name: Terraform Format + id: fmt + run: terraform fmt -check + + - name: Terraform Validate + id: validate + run: terraform validate + + - name: Terraform Plan + id: plan + if: github.event_name == 'pull_request' || github.ref == 'refs/heads/stage' + run: terraform plan -no-color -input=false + + - name: Terraform Apply + id: apply + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: terraform apply -auto-approve From d5e2da6476691725fa54c2f78c24661ae827a12c Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:17:41 +0530 Subject: [PATCH 06/15] hgj --- terraform/terraform.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index 427e5993e..8a9dc928f 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -36,4 +36,4 @@ terraform { } ### ## -### +#### From 6aa0aca60abdb3d17292232a25db9f6ddb90a7d6 Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:21:14 +0530 Subject: [PATCH 07/15] kjkj --- terraform/.github/workflows/terraform.yml | 102 ++++++++++------------ 1 file changed, 47 insertions(+), 55 deletions(-) diff --git a/terraform/.github/workflows/terraform.yml b/terraform/.github/workflows/terraform.yml index e07d96fce..ba4c3066e 100644 --- a/terraform/.github/workflows/terraform.yml +++ b/terraform/.github/workflows/terraform.yml @@ -1,69 +1,61 @@ name: "Vprofile IAC" - on: push: branches: - main - stage - paths: - - 'terraform/**' + paths: + - terraform/** pull_request: branches: - main paths: - - 'terraform/**' + - terraform/** env: - TF_VAR_region: us-east-1 - EKS_CLUSTER: kitops-eks + # Credentials for deployment to AWS + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # S3 bucket for the Terraform state + BUCKET_TF_STATE: ${{ secrets.BUCKET_TF_STATE}} + AWS_REGION: us-east-1 + EKS_CLUSTER: kitops-eks jobs: - terraform: - name: "Terraform EKS Infra" - runs-on: ubuntu-latest - defaults: - run: - shell: bash - working-directory: ./terraform - - steps: - - name: Checkout source code - id: checkout - uses: actions/checkout@v4 - - - name: Setup Terraform - id: setup_terraform - uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.6.3 - - - name: Configure AWS credentials - id: aws_creds - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Terraform Init - id: init - run: terraform init -backend-config="bucket=${{ secrets.BUCKET_TF_STATE }}" \ - -backend-config="region=us-east-1" - - - name: Terraform Format - id: fmt - run: terraform fmt -check - - - name: Terraform Validate - id: validate - run: terraform validate - - - name: Terraform Plan - id: plan - if: github.event_name == 'pull_request' || github.ref == 'refs/heads/stage' - run: terraform plan -no-color -input=false - - - name: Terraform Apply - id: apply - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - run: terraform apply -auto-approve + terraform: + name: "Apply terraform code changes" + runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ./terraform + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Setup Terraform with specified version on the runner + uses: hashicorp/setup-terraform@v2 + #with: + # terraform_version: 1.6.3 + + - name: Terraform init + id: init + run: terraform init -backend-config="bucket=$BUCKET_TF_STATE" + + - name: Terraform format + id: fmt + run: terraform fmt -check + + - name: Terraform validate + id: validate + run: terraform validate + + - name: Terraform plan + id: plan + run: terraform plan -no-color -input=false -out planfile + continue-on-error: true + + - name: Terraform plan status + if: steps.plan.outcome == 'failure' + run: exit 1 From 1b01fc1a917ed07abdfef48fbf08a3e660180afe Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:22:49 +0530 Subject: [PATCH 08/15] hghg --- terraform/terraform.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index 8a9dc928f..f418212b7 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -35,5 +35,4 @@ terraform { required_version = "~> 1.6.3" } ### -## #### From eba44fb7fa604ea01e0923525531529b352c5fb8 Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:24:20 +0530 Subject: [PATCH 09/15] jjhjk --- terraform/.github/workflows/{terraform.yml => terra.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename terraform/.github/workflows/{terraform.yml => terra.yaml} (100%) diff --git a/terraform/.github/workflows/terraform.yml b/terraform/.github/workflows/terra.yaml similarity index 100% rename from terraform/.github/workflows/terraform.yml rename to terraform/.github/workflows/terra.yaml From e6cc59ac589ce993a6e2dbbc29b5d80094459179 Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:25:03 +0530 Subject: [PATCH 10/15] nnbvn --- terraform/terraform.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index f418212b7..c6667c2e8 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -34,5 +34,5 @@ terraform { required_version = "~> 1.6.3" } -### +## #### From d83bd72907b004119f593ae684d76e1576046019 Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:28:56 +0530 Subject: [PATCH 11/15] fdd --- .../workflows/terra.yaml => .github/workflows/terraform.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename terraform/.github/workflows/terra.yaml => .github/workflows/terraform.yaml (100%) diff --git a/terraform/.github/workflows/terra.yaml b/.github/workflows/terraform.yaml similarity index 100% rename from terraform/.github/workflows/terra.yaml rename to .github/workflows/terraform.yaml From 20c8f245d7680729e117f58caf679abb908a74ec Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:31:56 +0530 Subject: [PATCH 12/15] new update --- .github/workflows/terraform.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index ba4c3066e..407799d09 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -36,8 +36,8 @@ jobs: - name: Setup Terraform with specified version on the runner uses: hashicorp/setup-terraform@v2 - #with: - # terraform_version: 1.6.3 + with: + terraform_version: 1.6.3 - name: Terraform init id: init From db4b58abbcd8d4feba37196b182f6201fa3d7d2d Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 14:32:31 +0530 Subject: [PATCH 13/15] hg --- terraform/terraform.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index c6667c2e8..fdcbb0fdc 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -35,4 +35,4 @@ terraform { required_version = "~> 1.6.3" } ## -#### +### From 3ee1dcbedb91ffae29d43a143112b31f285132a3 Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 15:59:15 +0530 Subject: [PATCH 14/15] update terraform apply --- .github/workflows/terraform.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index 407799d09..8f79385dd 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -59,3 +59,23 @@ jobs: - name: Terraform plan status if: steps.plan.outcome == 'failure' run: exit 1 + - name: Terraform Apply + id: apple + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: terraform apply -auto-approve -input=false -parallelism=1 planfile + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Get Kube config file + id: getconfig + if: steps.apple.outcome == 'success' + run: aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ env.EKS_CLUSTER }} + + - name: Install Ingress controller + if: steps.apple.outcome == 'success' && steps.getconfig.outcome == 'success' + run: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.3/deploy/static/provider/aws/deploy.yaml From 030db3df3a85d90b9a77f4c94ecaf819bd50b49b Mon Sep 17 00:00:00 2001 From: techdecipher Date: Sun, 10 Aug 2025 16:00:17 +0530 Subject: [PATCH 15/15] stating --- terraform/terraform.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index fdcbb0fdc..cbbe7a3a0 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -35,4 +35,4 @@ terraform { required_version = "~> 1.6.3" } ## -### +##