From 4afd52cdf4385e51f87aa1eaafb8eb7063c36692 Mon Sep 17 00:00:00 2001 From: jamesChege614 Date: Sun, 24 Aug 2025 10:15:51 +0300 Subject: [PATCH 1/6] just some interesting playground here --- terraform/vpc.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/vpc.tf b/terraform/vpc.tf index 5775ce1c3..8f7c3c617 100644 --- a/terraform/vpc.tf +++ b/terraform/vpc.tf @@ -7,8 +7,8 @@ module "vpc" { cidr = "172.20.0.0/16" azs = slice(data.aws_availability_zones.available.names, 0, 3) - private_subnets = ["172.20.1.0/24", "172.20.2.0/24", "172.20.3.0/24"] - public_subnets = ["172.20.4.0/24", "172.20.5.0/24", "172.20.6.0/24"] + #private_subnets = ["172.20.1.0/24", "172.20.2.0/24", "172.20.3.0/24"] + #public_subnets = ["172.20.4.0/24", "172.20.5.0/24", "172.20.6.0/24"] enable_nat_gateway = true single_nat_gateway = true From 1a7e27746feb8c2056b51691499395732e57d1e8 Mon Sep 17 00:00:00 2001 From: jamesChege614 Date: Sun, 24 Aug 2025 10:43:03 +0300 Subject: [PATCH 2/6] welcome all. Its starting to make sense now --- index.html | 11 +++++++++++ script.js | 0 style.css | 4 ++++ terraform/vpc.tf | 5 +++-- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 index.html create mode 100644 script.js create mode 100644 style.css diff --git a/index.html b/index.html new file mode 100644 index 000000000..512ce87e0 --- /dev/null +++ b/index.html @@ -0,0 +1,11 @@ + + + + + + Welcome to advanced git + + +

Git playground. Welcome all

+ + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 000000000..e69de29bb diff --git a/style.css b/style.css new file mode 100644 index 000000000..4d3566cd9 --- /dev/null +++ b/style.css @@ -0,0 +1,4 @@ +h1{ + color: aquamarine; + font: italic; +} \ No newline at end of file diff --git a/terraform/vpc.tf b/terraform/vpc.tf index 8f7c3c617..91d926a72 100644 --- a/terraform/vpc.tf +++ b/terraform/vpc.tf @@ -7,8 +7,9 @@ module "vpc" { cidr = "172.20.0.0/16" azs = slice(data.aws_availability_zones.available.names, 0, 3) - #private_subnets = ["172.20.1.0/24", "172.20.2.0/24", "172.20.3.0/24"] - #public_subnets = ["172.20.4.0/24", "172.20.5.0/24", "172.20.6.0/24"] +#This is just for tryout. + private_subnets = ["172.20.1.0/24", "172.20.2.0/24", "172.20.3.0/24"] + public_subnets = ["172.20.4.0/24", "172.20.5.0/24", "172.20.6.0/24"] enable_nat_gateway = true single_nat_gateway = true From 631c203e3fc0a8c271f370838863c1d60ad5c98e Mon Sep 17 00:00:00 2001 From: jamesChege614 Date: Sun, 24 Aug 2025 10:59:56 +0300 Subject: [PATCH 3/6] it has started to go down --- terraform/eks-cluster.tf | 6 +++--- terraform/main.tf | 4 +--- terraform/variables.tf | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/terraform/eks-cluster.tf b/terraform/eks-cluster.tf index 2c4610920..5a3795214 100644 --- a/terraform/eks-cluster.tf +++ b/terraform/eks-cluster.tf @@ -3,7 +3,7 @@ module "eks" { version = "19.19.1" cluster_name = local.cluster_name - cluster_version = "1.27" + cluster_version = "1.31" vpc_id = module.vpc.vpc_id subnet_ids = module.vpc.private_subnets @@ -21,8 +21,8 @@ module "eks" { instance_types = ["t3.small"] min_size = 1 - max_size = 3 - desired_size = 2 + max_size = 2 + desired_size = 1 } two = { diff --git a/terraform/main.tf b/terraform/main.tf index 94b6fc75a..0e16ac6f0 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -11,6 +11,4 @@ data "aws_availability_zones" "available" {} locals { cluster_name = var.clusterName -} - -## \ No newline at end of file +} \ No newline at end of file diff --git a/terraform/variables.tf b/terraform/variables.tf index a41d982a0..8ef682545 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 = "eu-central-1" } variable "clusterName" { From f76dbac867f813787f1ae98f784d4d925c11e137 Mon Sep 17 00:00:00 2001 From: jamesChege614 Date: Wed, 27 Aug 2025 12:09:01 +0300 Subject: [PATCH 4/6] not sure what I just changed. --- terraform/.github/workflow/terraform.yml | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 terraform/.github/workflow/terraform.yml diff --git a/terraform/.github/workflow/terraform.yml b/terraform/.github/workflow/terraform.yml new file mode 100644 index 000000000..6bf341e01 --- /dev/null +++ b/terraform/.github/workflow/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-2 + 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 + #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 ba8a8530c00a1133d5d2f900d4bd4a2d3b2282fd Mon Sep 17 00:00:00 2001 From: jamesChege614 Date: Wed, 27 Aug 2025 18:46:09 +0300 Subject: [PATCH 5/6] its about to get intense --- terraform/.github/workflow/terraform.yml | 2 +- terraform/terraform.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/.github/workflow/terraform.yml b/terraform/.github/workflow/terraform.yml index 6bf341e01..cc7f00e02 100644 --- a/terraform/.github/workflow/terraform.yml +++ b/terraform/.github/workflow/terraform.yml @@ -18,7 +18,7 @@ env: 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-2 + AWS_REGION: eu-central-1 EKS_CLUSTER: vprofile-eks jobs: diff --git a/terraform/terraform.tf b/terraform/terraform.tf index 67b75c673..9ac3a5732 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -29,7 +29,7 @@ terraform { backend "s3" { bucket = "gitopsterrastate" key = "terraform.tfstate" - region = "us-east-2" + region = "eu-central-1" } required_version = "~> 1.6.3" From 0983881bf9ec1ad4e7acd789d5fb97263ead3830 Mon Sep 17 00:00:00 2001 From: jamesChege614 Date: Thu, 28 Aug 2025 19:05:04 +0300 Subject: [PATCH 6/6] well well well, testing 1 2 --- terraform/outputs.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terraform/outputs.tf b/terraform/outputs.tf index 7d55c64ae..e1164f222 100644 --- a/terraform/outputs.tf +++ b/terraform/outputs.tf @@ -18,3 +18,5 @@ output "cluster_security_group_id" { description = "Security group ID for the Amazon Web Service EKS Cluster " value = module.eks.cluster_security_group_id } +# +# \ No newline at end of file