From badd10882b0561a4126bc40ed1317af93ef39a74 Mon Sep 17 00:00:00 2001 From: arthuar99 Date: Tue, 3 Feb 2026 11:46:31 +0200 Subject: [PATCH 1/8] chore: Update Terraform S3 backend bucket, region, and default AWS region and EKS cluster name variables. --- terraform/terraform.tf | 4 ++-- terraform/variables.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/terraform.tf b/terraform/terraform.tf index 67b75c673..6b35c317d 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -27,9 +27,9 @@ terraform { } backend "s3" { - bucket = "gitopsterrastate" + bucket = "ezio-profile-action" 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..d19424a8e 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -1,11 +1,11 @@ variable "region" { description = "AWS region" type = string - default = "us-east-2" + default = "us-east-1" } variable "clusterName" { description = "Name of the EKS cluster" type = string - default = "kitops-eks" + default = "vprofile-eks" } From 3df42b72ddd48fccbaa002525fe7dda4c47ea7e1 Mon Sep 17 00:00:00 2001 From: arthuar99 Date: Tue, 3 Feb 2026 11:53:23 +0200 Subject: [PATCH 2/8] Update terraform workflow for stage branch --- .github/workflows/terraform.yml | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/terraform.yml diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml new file mode 100644 index 000000000..b7fe24a23 --- /dev/null +++ b/.github/workflows/terraform.yml @@ -0,0 +1,59 @@ +name: "Vprofile Terraform" + +on: + push: + branches: + - main + paths: + - "terraform/**" + pull_request: + branches: + - main + paths: + - "terraform/**" + +env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + BUCKET_TF_NAME: ${{ secrets.BUCKET_TF_NAME }} + AWS_REGION: us-east-1 + EKS_CLUSTER: vprofile-eks + +jobs: + terraform: + name: "Terraform" + runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ./terraform + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: "1.1.7" + + - 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 + continue-on-error: true + + - name: Terraform plan status + if: steps.plan.outcome == 'failure' + run: exit 1 From 70c9085550c9941a07aaa613ce4025178fc19854 Mon Sep 17 00:00:00 2001 From: arthuar99 Date: Tue, 3 Feb 2026 12:03:02 +0200 Subject: [PATCH 3/8] Enable workflow on stage branch and fix bucket var --- .github/workflows/terraform.yml | 106 ++++++++++++++++---------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index b7fe24a23..7498b0375 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -1,59 +1,61 @@ name: "Vprofile Terraform" on: - push: - branches: - - main - paths: - - "terraform/**" - pull_request: - branches: - - main - paths: - - "terraform/**" + push: + branches: + - main + - stage + paths: + - "terraform/**" + pull_request: + branches: + - main + - stage + paths: + - "terraform/**" env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - BUCKET_TF_NAME: ${{ secrets.BUCKET_TF_NAME }} - AWS_REGION: us-east-1 - EKS_CLUSTER: vprofile-eks + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + BUCKET_TF_NAME: ${{ secrets.BUCKET_TF_NAME }} + AWS_REGION: us-east-1 + EKS_CLUSTER: vprofile-eks jobs: - terraform: - name: "Terraform" - runs-on: ubuntu-latest - defaults: - run: - shell: bash - working-directory: ./terraform - - steps: - - name: Checkout source code - uses: actions/checkout@v4 - - - name: Setup Terraform - uses: hashicorp/setup-terraform@v2 - with: - terraform_version: "1.1.7" - - - 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 - continue-on-error: true - - - name: Terraform plan status - if: steps.plan.outcome == 'failure' - run: exit 1 + terraform: + name: "Terraform" + runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ./terraform + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: "1.1.7" + + - name: Terraform Init + id: init + run: terraform init -backend-config="bucket=$BUCKET_TF_NAME " + + - 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 + continue-on-error: true + + - name: Terraform plan status + if: steps.plan.outcome == 'failure' + run: exit 1 From 0969f3ebae1de3766733c4f7b598739b464b620b Mon Sep 17 00:00:00 2001 From: arthuar99 Date: Tue, 3 Feb 2026 12:49:26 +0200 Subject: [PATCH 4/8] Allow workflow to trigger on changes to itself and add manual dispatch --- .github/workflows/terraform.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 7498b0375..4e29d9ae5 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -7,12 +7,15 @@ on: - stage paths: - "terraform/**" + - ".github/workflows/terraform.yml" pull_request: branches: - main - stage paths: - "terraform/**" + - ".github/workflows/terraform.yml" + workflow_dispatch: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} From d6fd77e96a6412f15cf7a61586b4fdad999fa890 Mon Sep 17 00:00:00 2001 From: arthuar99 Date: Tue, 3 Feb 2026 12:51:14 +0200 Subject: [PATCH 5/8] Update Terraform version to 1.6.3 to fix version mismatch --- .github/workflows/terraform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 4e29d9ae5..a300b352e 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -40,7 +40,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v2 with: - terraform_version: "1.1.7" + terraform_version: "1.6.3" - name: Terraform Init id: init From 59b3cf16464c3b30c453779e50b36ce2c2b1c4fc Mon Sep 17 00:00:00 2001 From: arthuar99 Date: Tue, 3 Feb 2026 12:53:14 +0200 Subject: [PATCH 6/8] Use BUCKET_NAME secret instead of BUCKET_TF_NAME --- .github/workflows/terraform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index a300b352e..5e87f52dd 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -20,7 +20,7 @@ on: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - BUCKET_TF_NAME: ${{ secrets.BUCKET_TF_NAME }} + BUCKET_TF_NAME: ${{ secrets.BUCKET_NAME }} AWS_REGION: us-east-1 EKS_CLUSTER: vprofile-eks From cb8e33f35cdd867223bed9ab7d5db867b310150f Mon Sep 17 00:00:00 2001 From: arthuar99 Date: Tue, 3 Feb 2026 12:57:06 +0200 Subject: [PATCH 7/8] Remove backend-config override as bucket is hardcoded in terraform.tf --- .github/workflows/terraform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 5e87f52dd..8d85fb7d0 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -44,7 +44,7 @@ jobs: - name: Terraform Init id: init - run: terraform init -backend-config="bucket=$BUCKET_TF_NAME " + run: terraform init - name: Terraform Format id: fmt From c7a4ea42fe36608e3e272c7fcfad5b798192d03f Mon Sep 17 00:00:00 2001 From: arthuar99 Date: Tue, 3 Feb 2026 14:12:33 +0200 Subject: [PATCH 8/8] Add Apply, Ingress steps and fix planfile output --- .github/workflows/terraform.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 8d85fb7d0..052febe49 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -56,9 +56,30 @@ jobs: - name: Terraform Plan id: plan - run: terraform plan -no-color -input=false + 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 + + - name: Terraform Apply + id: apply + 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.apply.outcome == 'success' + run: aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ env.EKS_CLUSTER }} + + - name: Install Ingress controller + if: steps.apply.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