Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1db5180
vprofile
yogeshmoharkar Mar 24, 2026
ade3419
staging workflow
yogeshmoharkar Mar 24, 2026
d53c583
staging update
yogeshmoharkar Mar 24, 2026
0c8bc01
stage update 1
yogeshmoharkar Mar 24, 2026
bb72885
staging
yogeshmoharkar Mar 24, 2026
0cdc8e9
stage update
yogeshmoharkar Mar 24, 2026
4c19c08
terraform update
yogeshmoharkar Mar 24, 2026
861e377
test workflow
yogeshmoharkar Mar 24, 2026
1ffa2ec
chnages update
yogeshmoharkar Mar 24, 2026
68dbc33
staging update
yogeshmoharkar Mar 24, 2026
281fd56
updated code
yogeshmoharkar Mar 24, 2026
0f4519b
terrafome staging code
yogeshmoharkar Mar 24, 2026
d7f2b78
Terraform update
yogeshmoharkar Mar 24, 2026
c72b75e
Terraform update 1
yogeshmoharkar Mar 24, 2026
00d0b4f
Terraform Apply Stagging
yogeshmoharkar Mar 25, 2026
348350c
Terraform Apply Stagging
yogeshmoharkar Mar 25, 2026
655bda1
Terraform Apply Stagging update
yogeshmoharkar Mar 25, 2026
47aed36
terraform update stage
yogeshmoharkar Mar 25, 2026
c631092
terraform update plan
yogeshmoharkar Mar 25, 2026
254c863
Terraform update code
yogeshmoharkar Mar 25, 2026
60a0d94
Stage plan
yogeshmoharkar Mar 25, 2026
f0ace75
Terraform update 1
yogeshmoharkar Mar 25, 2026
8b4af7c
Terra push code
yogeshmoharkar Mar 25, 2026
54578a9
fix: update AMI type to AL2023 for k8s 1.33
yogeshmoharkar Mar 25, 2026
5af15c6
fix: set cluster 1.33 and AL2023 AMI type
yogeshmoharkar Mar 25, 2026
3b4f173
fix: update terraform and aws provider versions
yogeshmoharkar Mar 25, 2026
ebb262d
fix: allow any terraform version >= 1.0.0
yogeshmoharkar Mar 25, 2026
de73600
add terraform destroy workflow
yogeshmoharkar Mar 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/terraform-destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Terraform Destroy"
on:
workflow_dispatch:

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
BUCKET_tf_STATE: ${{ secrets.BUCKET_tf_STATE }}
AWS_REGION: us-east-1

jobs:
destroy:
name: "Terraform Destroy"
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

- name: Terraform Init
run: terraform init -backend-config=bucket=${BUCKET_tf_STATE}

- name: Terraform Destroy
run: terraform destroy -auto-approve -input=false
79 changes: 79 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: "Vprofile IAC"
on:
push:
branches:
- main
- stage
pull_request:
branches:
- main
workflow_dispatch:

env:
# Creds for deployment to AWS account
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
#S3 bucket for the terraform state
BUCKET_tf_STATE: ${{secrets.BUCKET_tf_STATE}}
AWS_REGION: us-east-1
EKS_CLUSTER: vprofile-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

- name: Terraform Init
id: init
run: terraform init -backend-config=bucket=${BUCKET_tf_STATE}

- name: Terraform format
id: fmt
run: terraform fmt

- 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
id: 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
4 changes: 2 additions & 2 deletions terraform/eks-cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module "eks" {
version = "19.19.1"

cluster_name = local.cluster_name
cluster_version = "1.27"
cluster_version = "1.33"

vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets
cluster_endpoint_public_access = true

eks_managed_node_group_defaults = {
ami_type = "AL2_x86_64"
ami_type = "AL2023_x86_64_STANDARD"

}

Expand Down
2 changes: 0 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ data "aws_availability_zones" "available" {}
locals {
cluster_name = var.clusterName
}

##
11 changes: 4 additions & 7 deletions terraform/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.25.0"
version = "~> 5.80.0"
}

random = {
Expand All @@ -27,13 +27,10 @@ terraform {
}

backend "s3" {
bucket = "gitopsterrastate"
bucket = "terraform-bucekt-state01"
key = "terraform.tfstate"
region = "us-east-2"
region = "us-east-1"
}

required_version = "~> 1.6.3"
required_version = ">= 1.0.0"
}
##
##
##
7 changes: 5 additions & 2 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
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"
}


###test