From 83442ae7f3f827788346518d8463d71fa18fbc08 Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:37:57 +0530 Subject: [PATCH 01/34] Change AWS region from ap-northeast-1 to us-east-1 --- 0-bootstrap/providers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0-bootstrap/providers.tf b/0-bootstrap/providers.tf index eaab0b6..2c5eab9 100644 --- a/0-bootstrap/providers.tf +++ b/0-bootstrap/providers.tf @@ -10,6 +10,6 @@ terraform { } provider "aws" { - region = "ap-northeast-1" + region = "us-east-1" } From 443ad9126d66f089c59bbb533c94746a197fa172 Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:38:26 +0530 Subject: [PATCH 02/34] Update backend.tf --- 1-network/backend.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-network/backend.tf b/1-network/backend.tf index e6d111b..fed8262 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -2,8 +2,8 @@ terraform { backend "s3" { bucket = "quantamvector-infra-statefile-backup" key = "quantamvector/1-network/terraform.tfstate" - region = "ap-northeast-1" + region = "us-east-1" dynamodb_table = "quantamvector-terraform-locks" encrypt = true } -} \ No newline at end of file +} From f9fa5433a27b342492c51524143b92c8fa75aafd Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:39:16 +0530 Subject: [PATCH 03/34] Update providers.tf --- 1-network/providers.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-network/providers.tf b/1-network/providers.tf index 564aab2..0318a4f 100644 --- a/1-network/providers.tf +++ b/1-network/providers.tf @@ -10,5 +10,5 @@ terraform { } provider "aws" { - region = "ap-northeast-1" -} \ No newline at end of file + region = "us-east-1" +} From 08faad000ac80f8ff0aabb7a394b195ca2d2e87e Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:40:47 +0530 Subject: [PATCH 04/34] Change default availability zones to US East --- 1-network/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-network/variables.tf b/1-network/variables.tf index b669d16..01dd901 100644 --- a/1-network/variables.tf +++ b/1-network/variables.tf @@ -10,5 +10,5 @@ variable "vpc_cidr" { variable "azs" { type = list(string) - default = ["ap-northeast-1a", "ap-northeast-1c", "ap-northeast-1d"] + default = ["us-east-1a", "us-east-1b"] } From 4aa19f079b860fe661487bd918ae23143dc730b5 Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:41:34 +0530 Subject: [PATCH 05/34] Update backend.tf --- 2-eks/backend.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2-eks/backend.tf b/2-eks/backend.tf index dcca4af..14ee522 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -2,8 +2,8 @@ terraform { backend "s3" { bucket = "quantamvector-infra-statefile-backup" key = "quantamvector/2-eks/terraform.tfstate" - region = "ap-northeast-1" + region = "us-east-1" dynamodb_table = "quantamvector-terraform-locks" encrypt = true } -} \ No newline at end of file +} From c9f1dc5ac1157ba2695a13eb02d506a54622f450 Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:41:51 +0530 Subject: [PATCH 06/34] Change S3 region from ap-northeast-1 to us-east-1 --- 2-eks/data.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-eks/data.tf b/2-eks/data.tf index 533c278..0724692 100644 --- a/2-eks/data.tf +++ b/2-eks/data.tf @@ -4,6 +4,6 @@ data "terraform_remote_state" "network" { config = { bucket = "quantamvector-infra-statefile-backup" key = "quantamvector/1-network/terraform.tfstate" - region = "ap-northeast-1" + region = "us-east-1" } } From 7ff321ebd1dd2bd7cf93aa333e6539392b37c769 Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:42:24 +0530 Subject: [PATCH 07/34] Change region output from ap-northeast-1 to us-east-1 --- 2-eks/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-eks/outputs.tf b/2-eks/outputs.tf index 0502f6b..2410276 100644 --- a/2-eks/outputs.tf +++ b/2-eks/outputs.tf @@ -11,5 +11,5 @@ output "cluster_certificate_authority_data" { } output "region" { - value = "ap-northeast-1" + value = "us-east-1" } From 96bf789c08864cdb88a1a1a3ee363feeb3e84640 Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:42:40 +0530 Subject: [PATCH 08/34] Update providers.tf --- 2-eks/providers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-eks/providers.tf b/2-eks/providers.tf index 56eadea..0318a4f 100644 --- a/2-eks/providers.tf +++ b/2-eks/providers.tf @@ -10,5 +10,5 @@ terraform { } provider "aws" { - region = "ap-northeast-1" + region = "us-east-1" } From 93c83fdaae46bc331f5b4b7d511b9d37c3ca4bfd Mon Sep 17 00:00:00 2001 From: Ganapathi Laxman Raju <95155699+laxmanraju4144@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:43:46 +0530 Subject: [PATCH 09/34] Change default SSH key name for EC2 access --- 2-eks/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-eks/variables.tf b/2-eks/variables.tf index ccfc33c..0263498 100644 --- a/2-eks/variables.tf +++ b/2-eks/variables.tf @@ -11,5 +11,5 @@ variable "kubernetes_version" { variable "ssh_key_name" { type = string description = "Name of the EC2 key pair for SSH access to worker nodes" - default = "Tokyo-key" + default = "Common.pem" } From 67c701567562a5fe9cab8c80a269073a36c460b7 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Sun, 12 Apr 2026 12:43:11 +0530 Subject: [PATCH 10/34] changed the regiou across the cluster --- 0-bootstrap/main.tf | 4 ++-- 1-network/backend.tf | 4 ++-- 2-eks/backend.tf | 6 +++--- 2-eks/data.tf | 4 ++-- 2-eks/variables.tf | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/0-bootstrap/main.tf b/0-bootstrap/main.tf index be3941d..a2dc91e 100644 --- a/0-bootstrap/main.tf +++ b/0-bootstrap/main.tf @@ -1,5 +1,5 @@ resource "aws_s3_bucket" "tf_state" { - bucket = "quantamvector-infra-statefile-backup" + bucket = "laxmanraju-state-lock" } resource "aws_s3_bucket_versioning" "tf_state" { @@ -30,7 +30,7 @@ resource "aws_s3_bucket_public_access_block" "tf_state" { } resource "aws_dynamodb_table" "tf_lock" { - name = "quantamvector-terraform-locks" + name = "laxmanraju-statefile-backup" billing_mode = "PAY_PER_REQUEST" hash_key = "LockID" diff --git a/1-network/backend.tf b/1-network/backend.tf index fed8262..9fa235d 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -1,9 +1,9 @@ terraform { backend "s3" { - bucket = "quantamvector-infra-statefile-backup" + bucket = "laxmanraju-state-lock" key = "quantamvector/1-network/terraform.tfstate" region = "us-east-1" - dynamodb_table = "quantamvector-terraform-locks" + dynamodb_table = "laxmanraju-statefile-backup" encrypt = true } } diff --git a/2-eks/backend.tf b/2-eks/backend.tf index 14ee522..6157c15 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -1,9 +1,9 @@ terraform { backend "s3" { - bucket = "quantamvector-infra-statefile-backup" - key = "quantamvector/2-eks/terraform.tfstate" + bucket = "laxmanraju-state-lock" + key = "laxmanraju/2-eks/terraform.tfstate" region = "us-east-1" - dynamodb_table = "quantamvector-terraform-locks" + dynamodb_table = "laxmanraju-statefile-backup" encrypt = true } } diff --git a/2-eks/data.tf b/2-eks/data.tf index 0724692..57ef006 100644 --- a/2-eks/data.tf +++ b/2-eks/data.tf @@ -2,8 +2,8 @@ data "terraform_remote_state" "network" { backend = "s3" config = { - bucket = "quantamvector-infra-statefile-backup" - key = "quantamvector/1-network/terraform.tfstate" + bucket = "laxmanraju-state-lock" + key = "laxmanraju/1-network/terraform.tfstate" region = "us-east-1" } } diff --git a/2-eks/variables.tf b/2-eks/variables.tf index 0263498..ab3c309 100644 --- a/2-eks/variables.tf +++ b/2-eks/variables.tf @@ -1,6 +1,6 @@ variable "project" { type = string - default = "quantamvector" + default = "microservices" } variable "kubernetes_version" { From 34e9c59be6575e7badcea1829e22a9aa7153afe5 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Sun, 12 Apr 2026 12:51:57 +0530 Subject: [PATCH 11/34] second push --- 1-network/backend.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-network/backend.tf b/1-network/backend.tf index 9fa235d..5f791b9 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -1,7 +1,7 @@ terraform { backend "s3" { bucket = "laxmanraju-state-lock" - key = "quantamvector/1-network/terraform.tfstate" + key = "laxmanraju/1-network/terraform.tfstate" region = "us-east-1" dynamodb_table = "laxmanraju-statefile-backup" encrypt = true From 3af1a1e6c36bb6f9ad70b12d98d9b5f75cf3844f Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Sun, 12 Apr 2026 12:54:06 +0530 Subject: [PATCH 12/34] 3 push --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ea39eb2..ceb2aa6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { environment { AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') - AWS_DEFAULT_REGION = 'ap-northeast-1' + AWS_DEFAULT_REGION = 'us-east-1' } agent any @@ -22,7 +22,7 @@ pipeline { steps { script { dir('terraform') { - git url: 'https://github.com/QuntamVector/Infrastructure.git', branch: 'main' + git url: 'https://github.com/laxmanraju4144/Infrastructure.git', branch: 'main' } } } From be541ad283277a09a1ddf3d6ff288efd9308c706 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Sun, 12 Apr 2026 13:29:46 +0530 Subject: [PATCH 13/34] updating the key pair --- 2-eks/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-eks/variables.tf b/2-eks/variables.tf index ab3c309..c916508 100644 --- a/2-eks/variables.tf +++ b/2-eks/variables.tf @@ -11,5 +11,5 @@ variable "kubernetes_version" { variable "ssh_key_name" { type = string description = "Name of the EC2 key pair for SSH access to worker nodes" - default = "Common.pem" + default = "Common" } From 28f94a90f617343fbdacb6808810e0d7cab1ad59 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 21 Apr 2026 11:38:36 +0530 Subject: [PATCH 14/34] chnaged --- 0-bootstrap/main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/0-bootstrap/main.tf b/0-bootstrap/main.tf index a2dc91e..953e5a0 100644 --- a/0-bootstrap/main.tf +++ b/0-bootstrap/main.tf @@ -39,3 +39,5 @@ resource "aws_dynamodb_table" "tf_lock" { type = "S" } } + +//updated \ No newline at end of file From 4212e9a3db1c17f1cb052af219463abcc9bf5450 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Wed, 22 Apr 2026 10:45:37 +0530 Subject: [PATCH 15/34] latest chnages --- 1-network/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-network/variables.tf b/1-network/variables.tf index 01dd901..79580fd 100644 --- a/1-network/variables.tf +++ b/1-network/variables.tf @@ -1,6 +1,6 @@ variable "project" { type = string - default = "quantamvector" + default = "microservices" } variable "vpc_cidr" { From faedd2feb8adcdfb084734c5216d91cef6daceb9 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Fri, 24 Apr 2026 21:20:41 +0530 Subject: [PATCH 16/34] latest changes --- 0-bootstrap/.terraform.lock.hcl | 1 + 2-eks/.terraform/terraform.tfstate | 55 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 2-eks/.terraform/terraform.tfstate diff --git a/0-bootstrap/.terraform.lock.hcl b/0-bootstrap/.terraform.lock.hcl index cdc1668..9f8c609 100644 --- a/0-bootstrap/.terraform.lock.hcl +++ b/0-bootstrap/.terraform.lock.hcl @@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.0" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", diff --git a/2-eks/.terraform/terraform.tfstate b/2-eks/.terraform/terraform.tfstate new file mode 100644 index 0000000..b6fc81c --- /dev/null +++ b/2-eks/.terraform/terraform.tfstate @@ -0,0 +1,55 @@ +{ + "version": 3, + "terraform_version": "1.10.3", + "backend": { + "type": "s3", + "config": { + "access_key": null, + "acl": null, + "allowed_account_ids": null, + "assume_role": null, + "assume_role_with_web_identity": null, + "bucket": "laxmanraju-state-lock", + "custom_ca_bundle": null, + "dynamodb_endpoint": null, + "dynamodb_table": "laxmanraju-statefile-backup", + "ec2_metadata_service_endpoint": null, + "ec2_metadata_service_endpoint_mode": null, + "encrypt": true, + "endpoint": null, + "endpoints": null, + "forbidden_account_ids": null, + "force_path_style": null, + "http_proxy": null, + "https_proxy": null, + "iam_endpoint": null, + "insecure": null, + "key": "laxmanraju/2-eks/terraform.tfstate", + "kms_key_id": null, + "max_retries": null, + "no_proxy": null, + "profile": null, + "region": "us-east-1", + "retry_mode": null, + "secret_key": null, + "shared_config_files": null, + "shared_credentials_file": null, + "shared_credentials_files": null, + "skip_credentials_validation": null, + "skip_metadata_api_check": null, + "skip_region_validation": null, + "skip_requesting_account_id": null, + "skip_s3_checksum": null, + "sse_customer_key": null, + "sts_endpoint": null, + "sts_region": null, + "token": null, + "use_dualstack_endpoint": null, + "use_fips_endpoint": null, + "use_lockfile": null, + "use_path_style": null, + "workspace_key_prefix": null + }, + "hash": 2092075295 + } +} \ No newline at end of file From 1fbcbacc62645f6b5941feca4e724d49b54332ca Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Fri, 24 Apr 2026 21:31:52 +0530 Subject: [PATCH 17/34] latets chnages --- 0-bootstrap/main.tf | 4 ++-- 1-network/backend.tf | 4 ++-- 2-eks/backend.tf | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/0-bootstrap/main.tf b/0-bootstrap/main.tf index 953e5a0..1ae63f5 100644 --- a/0-bootstrap/main.tf +++ b/0-bootstrap/main.tf @@ -1,5 +1,5 @@ resource "aws_s3_bucket" "tf_state" { - bucket = "laxmanraju-state-lock" + bucket = "laxmanraju-state-1-lock" } resource "aws_s3_bucket_versioning" "tf_state" { @@ -30,7 +30,7 @@ resource "aws_s3_bucket_public_access_block" "tf_state" { } resource "aws_dynamodb_table" "tf_lock" { - name = "laxmanraju-statefile-backup" + name = "laxmanraju-state-2-lock" billing_mode = "PAY_PER_REQUEST" hash_key = "LockID" diff --git a/1-network/backend.tf b/1-network/backend.tf index 5f791b9..5fadf62 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -1,9 +1,9 @@ terraform { backend "s3" { - bucket = "laxmanraju-state-lock" + bucket = "laxmanraju-state-1-lock" key = "laxmanraju/1-network/terraform.tfstate" region = "us-east-1" - dynamodb_table = "laxmanraju-statefile-backup" + dynamodb_table = "laxmanraju-state-2-lock" encrypt = true } } diff --git a/2-eks/backend.tf b/2-eks/backend.tf index 6157c15..e6fd58d 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -1,9 +1,9 @@ terraform { backend "s3" { - bucket = "laxmanraju-state-lock" + bucket = "laxmanraju-state-1-lock" key = "laxmanraju/2-eks/terraform.tfstate" region = "us-east-1" - dynamodb_table = "laxmanraju-statefile-backup" + dynamodb_table = "laxmanraju-state-2-lock" encrypt = true } } From f7f3e2668f9e2e88c6eb303fe8df01c8683a0bbf Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 15:01:44 +0530 Subject: [PATCH 18/34] Add .gitignore for Terraform files --- .gitignore | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..abb9d13 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Local .terraform directories +.terraform/ + +# Terraform state files +*.tfstate +*.tfstate.* + +# Crash logs +crash.log + +# Override files +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Terraform lock file (optional) +# Commit if you want reproducible provider versions, otherwise ignore +.terraform.lock.hcl + +# Sensitive variable files +*.tfvars +*.tfvars.json From 9709c2f9412ef5eea5592b9f8937812b573c3ea4 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 15:05:15 +0530 Subject: [PATCH 19/34] latest changes --- 0-bootstrap/.terraform.lock.hcl | 1 - 1-network/backend.tf | 2 +- 2-eks/backend.tf | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/0-bootstrap/.terraform.lock.hcl b/0-bootstrap/.terraform.lock.hcl index 9f8c609..92a2bcc 100644 --- a/0-bootstrap/.terraform.lock.hcl +++ b/0-bootstrap/.terraform.lock.hcl @@ -6,7 +6,6 @@ provider "registry.terraform.io/hashicorp/aws" { constraints = "~> 5.0" hashes = [ "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", - "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", "zh:1589a2266af699cbd5d80737a0fe02e54ec9cf2ca54e7e00ac51c7359056f274", diff --git a/1-network/backend.tf b/1-network/backend.tf index 5fadf62..d80c2ee 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -3,7 +3,7 @@ terraform { bucket = "laxmanraju-state-1-lock" key = "laxmanraju/1-network/terraform.tfstate" region = "us-east-1" - dynamodb_table = "laxmanraju-state-2-lock" + dynamodb_table = "laxmanraju-state-1-lock" encrypt = true } } diff --git a/2-eks/backend.tf b/2-eks/backend.tf index e6fd58d..e062bb6 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -3,7 +3,7 @@ terraform { bucket = "laxmanraju-state-1-lock" key = "laxmanraju/2-eks/terraform.tfstate" region = "us-east-1" - dynamodb_table = "laxmanraju-state-2-lock" + dynamodb_table = "laxmanraju-state-1-lock" encrypt = true } } From 76a314bdc77a83897002684747ca6c34aed40834 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 15:20:50 +0530 Subject: [PATCH 20/34] latest chnages --- 0-bootstrap/main.tf | 2 +- 1-network/backend.tf | 2 +- 2-eks/backend.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/0-bootstrap/main.tf b/0-bootstrap/main.tf index 1ae63f5..5bf5d50 100644 --- a/0-bootstrap/main.tf +++ b/0-bootstrap/main.tf @@ -30,7 +30,7 @@ resource "aws_s3_bucket_public_access_block" "tf_state" { } resource "aws_dynamodb_table" "tf_lock" { - name = "laxmanraju-state-2-lock" + name = "laxmanraju-state-DB-1-lock" billing_mode = "PAY_PER_REQUEST" hash_key = "LockID" diff --git a/1-network/backend.tf b/1-network/backend.tf index d80c2ee..43037ea 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -3,7 +3,7 @@ terraform { bucket = "laxmanraju-state-1-lock" key = "laxmanraju/1-network/terraform.tfstate" region = "us-east-1" - dynamodb_table = "laxmanraju-state-1-lock" + dynamodb_table = "laxmanraju-state-DB-1-lock" encrypt = true } } diff --git a/2-eks/backend.tf b/2-eks/backend.tf index e062bb6..83d9127 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -3,7 +3,7 @@ terraform { bucket = "laxmanraju-state-1-lock" key = "laxmanraju/2-eks/terraform.tfstate" region = "us-east-1" - dynamodb_table = "laxmanraju-state-1-lock" + dynamodb_table = "laxmanraju-state-DB-1-lock" encrypt = true } } From 6796b288278c256284d6ec9ae5a29a07751cde8b Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 16:09:18 +0530 Subject: [PATCH 21/34] latest changes --- Jenkinsfile | 216 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 181 insertions(+), 35 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ceb2aa6..534b863 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,157 @@ +// pipeline { + +// parameters { +// choice( +// name: 'terraformAction', +// choices: ['apply', 'destroy'], +// description: 'Choose your terraform action' +// ) +// } + +// environment { +// AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') +// AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') +// AWS_DEFAULT_REGION = 'us-east-1' +// } + +// agent any + +// stages { + +// stage('Checkout') { +// steps { +// script { +// dir('terraform') { +// git url: 'https://github.com/laxmanraju4144/Infrastructure.git', branch: 'main' +// } +// } +// } +// } + +// // ─── APPLY STAGES ───────────────────────────────────────────────────── + +// stage('Plan: 0-bootstrap') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// sh 'cd terraform/0-bootstrap && terraform init -input=false' +// // Import existing resources into state if they already exist in AWS +// // '|| true' ensures pipeline does not fail if resource does not exist yet (first run) +// sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state quantamvector-infra-statefile-backup || true' +// sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' +// sh 'cd terraform/0-bootstrap && terraform plan -out tfplan' +// sh 'cd terraform/0-bootstrap && terraform show -no-color tfplan > tfplan.txt' +// } +// } + +// stage('Approval: 0-bootstrap') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// script { +// def plan = readFile 'terraform/0-bootstrap/tfplan.txt' +// input message: '[0-bootstrap] Approve to proceed', +// parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] +// } +// } +// } + +// stage('Apply: 0-bootstrap') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// sh 'cd terraform/0-bootstrap && terraform apply -input=false tfplan' +// } +// } + +// stage('Plan: 1-network') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// sh 'cd terraform/1-network && terraform init -input=false' +// sh 'cd terraform/1-network && terraform plan -out tfplan' +// sh 'cd terraform/1-network && terraform show -no-color tfplan > tfplan.txt' +// } +// } + +// stage('Approval: 1-network') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// script { +// def plan = readFile 'terraform/1-network/tfplan.txt' +// input message: '[1-network] Approve to proceed', +// parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] +// } +// } +// } + +// stage('Apply: 1-network') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// sh 'cd terraform/1-network && terraform apply -input=false tfplan' +// } +// } + +// stage('Plan: 2-eks') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// sh 'cd terraform/2-eks && terraform init -input=false' +// sh 'cd terraform/2-eks && terraform plan -out tfplan' +// sh 'cd terraform/2-eks && terraform show -no-color tfplan > tfplan.txt' +// } +// } + +// stage('Approval: 2-eks') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// script { +// def plan = readFile 'terraform/2-eks/tfplan.txt' +// input message: '[2-eks] Approve to proceed', +// parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] +// } +// } +// } + +// stage('Apply: 2-eks') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// sh 'cd terraform/2-eks && terraform apply -input=false tfplan' +// } +// } + +// // ─── DESTROY STAGES (reverse order) ─────────────────────────────────── + +// stage('Destroy: 2-eks') { +// when { expression { params.terraformAction == 'destroy' } } +// steps { +// sh 'cd terraform/2-eks && terraform init -input=false' +// sh 'cd terraform/2-eks && terraform destroy -auto-approve' +// } +// } + +// stage('Destroy: 1-network') { +// when { expression { params.terraformAction == 'destroy' } } +// steps { +// sh 'cd terraform/1-network && terraform init -input=false' +// sh 'cd terraform/1-network && terraform destroy -auto-approve' +// } +// } + +// stage('Destroy: 0-bootstrap') { +// when { expression { params.terraformAction == 'destroy' } } +// steps { +// sh 'cd terraform/0-bootstrap && terraform init -input=false' +// sh 'cd terraform/0-bootstrap && terraform destroy -auto-approve' +// } +// } + +// } + +// post { +// success { +// echo "terraform ${params.terraformAction} completed successfully." +// } +// failure { +// echo "Pipeline failed. Check the stage logs above." +// } +// } +// } pipeline { parameters { @@ -6,6 +160,11 @@ pipeline { choices: ['apply', 'destroy'], description: 'Choose your terraform action' ) + choice( + name: 'initMode', + choices: ['migrate', 'reconfigure'], + description: 'Choose how to handle backend changes' + ) } environment { @@ -33,9 +192,10 @@ pipeline { stage('Plan: 0-bootstrap') { when { expression { params.terraformAction == 'apply' } } steps { - sh 'cd terraform/0-bootstrap && terraform init -input=false' - // Import existing resources into state if they already exist in AWS - // '|| true' ensures pipeline does not fail if resource does not exist yet (first run) + script { + def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' + sh "cd terraform/0-bootstrap && terraform init ${initFlag} -input=false" + } sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state quantamvector-infra-statefile-backup || true' sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' sh 'cd terraform/0-bootstrap && terraform plan -out tfplan' @@ -64,7 +224,10 @@ pipeline { stage('Plan: 1-network') { when { expression { params.terraformAction == 'apply' } } steps { - sh 'cd terraform/1-network && terraform init -input=false' + script { + def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' + sh "cd terraform/1-network && terraform init ${initFlag} -input=false" + } sh 'cd terraform/1-network && terraform plan -out tfplan' sh 'cd terraform/1-network && terraform show -no-color tfplan > tfplan.txt' } @@ -88,39 +251,17 @@ pipeline { } } - stage('Plan: 2-eks') { - when { expression { params.terraformAction == 'apply' } } - steps { - sh 'cd terraform/2-eks && terraform init -input=false' - sh 'cd terraform/2-eks && terraform plan -out tfplan' - sh 'cd terraform/2-eks && terraform show -no-color tfplan > tfplan.txt' - } - } + // Continue with 2-eks stages (same pattern)... - stage('Approval: 2-eks') { - when { expression { params.terraformAction == 'apply' } } - steps { - script { - def plan = readFile 'terraform/2-eks/tfplan.txt' - input message: '[2-eks] Approve to proceed', - parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] - } - } - } - - stage('Apply: 2-eks') { - when { expression { params.terraformAction == 'apply' } } - steps { - sh 'cd terraform/2-eks && terraform apply -input=false tfplan' - } - } - - // ─── DESTROY STAGES (reverse order) ─────────────────────────────────── + // ─── DESTROY STAGES ─────────────────────────────────────────────────── stage('Destroy: 2-eks') { when { expression { params.terraformAction == 'destroy' } } steps { - sh 'cd terraform/2-eks && terraform init -input=false' + script { + def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' + sh "cd terraform/2-eks && terraform init ${initFlag} -input=false" + } sh 'cd terraform/2-eks && terraform destroy -auto-approve' } } @@ -128,7 +269,10 @@ pipeline { stage('Destroy: 1-network') { when { expression { params.terraformAction == 'destroy' } } steps { - sh 'cd terraform/1-network && terraform init -input=false' + script { + def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' + sh "cd terraform/1-network && terraform init ${initFlag} -input=false" + } sh 'cd terraform/1-network && terraform destroy -auto-approve' } } @@ -136,11 +280,13 @@ pipeline { stage('Destroy: 0-bootstrap') { when { expression { params.terraformAction == 'destroy' } } steps { - sh 'cd terraform/0-bootstrap && terraform init -input=false' + script { + def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' + sh "cd terraform/0-bootstrap && terraform init ${initFlag} -input=false" + } sh 'cd terraform/0-bootstrap && terraform destroy -auto-approve' } } - } post { From 1d22e474132df1e9fb9de3b710f1de45861e18d9 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 16:14:09 +0530 Subject: [PATCH 22/34] latest chnages --- 0-bootstrap/main.tf | 2 +- 1-network/backend.tf | 2 +- 2-eks/backend.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/0-bootstrap/main.tf b/0-bootstrap/main.tf index 5bf5d50..bd1dede 100644 --- a/0-bootstrap/main.tf +++ b/0-bootstrap/main.tf @@ -1,5 +1,5 @@ resource "aws_s3_bucket" "tf_state" { - bucket = "laxmanraju-state-1-lock" + bucket = "laxmanraju-state-lock" } resource "aws_s3_bucket_versioning" "tf_state" { diff --git a/1-network/backend.tf b/1-network/backend.tf index 43037ea..e22f922 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -1,6 +1,6 @@ terraform { backend "s3" { - bucket = "laxmanraju-state-1-lock" + bucket = "laxmanraju-state-lock" key = "laxmanraju/1-network/terraform.tfstate" region = "us-east-1" dynamodb_table = "laxmanraju-state-DB-1-lock" diff --git a/2-eks/backend.tf b/2-eks/backend.tf index 83d9127..e2e3e0e 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -1,6 +1,6 @@ terraform { backend "s3" { - bucket = "laxmanraju-state-1-lock" + bucket = "laxmanraju-state-lock" key = "laxmanraju/2-eks/terraform.tfstate" region = "us-east-1" dynamodb_table = "laxmanraju-state-DB-1-lock" From 7b51465a28558c01e4e3657f3fa9282bbf31b9ce Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 16:31:58 +0530 Subject: [PATCH 23/34] latest chnages --- 0-bootstrap/main.tf | 20 ++++++++++---------- 1-network/backend.tf | 22 ++++++++++++++++------ markers.json | 1 + 3 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 markers.json diff --git a/0-bootstrap/main.tf b/0-bootstrap/main.tf index bd1dede..af5fa24 100644 --- a/0-bootstrap/main.tf +++ b/0-bootstrap/main.tf @@ -29,15 +29,15 @@ resource "aws_s3_bucket_public_access_block" "tf_state" { restrict_public_buckets = true } -resource "aws_dynamodb_table" "tf_lock" { - name = "laxmanraju-state-DB-1-lock" - billing_mode = "PAY_PER_REQUEST" - hash_key = "LockID" - - attribute { - name = "LockID" - type = "S" - } -} +# resource "aws_dynamodb_table" "tf_lock" { +# name = "laxmanraju-state-DB-1-lock" +# billing_mode = "PAY_PER_REQUEST" +# hash_key = "LockID" + +# attribute { +# name = "LockID" +# type = "S" +# } +# } //updated \ No newline at end of file diff --git a/1-network/backend.tf b/1-network/backend.tf index e22f922..32cfda9 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -1,9 +1,19 @@ +# terraform { +# backend "s3" { +# bucket = "laxmanraju-state-lock" +# key = "laxmanraju/1-network/terraform.tfstate" +# region = "us-east-1" +# dynamodb_table = "laxmanraju-state-DB-1-lock" +# encrypt = true +# } +# } + terraform { backend "s3" { - bucket = "laxmanraju-state-lock" - key = "laxmanraju/1-network/terraform.tfstate" - region = "us-east-1" - dynamodb_table = "laxmanraju-state-DB-1-lock" - encrypt = true + bucket = "laxmanraju-state-lock" # your S3 bucket + key = "env/terraform.tfstate" # path inside the bucket + region = "us-east-1" + encrypt = true + use_lockfile = true # replaces dynamodb_table } -} +} \ No newline at end of file diff --git a/markers.json b/markers.json new file mode 100644 index 0000000..19765bd --- /dev/null +++ b/markers.json @@ -0,0 +1 @@ +null From e6a765759a5a5a0bfa93f307e5c35514b862652b Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 16:37:31 +0530 Subject: [PATCH 24/34] latest chnages --- 0-bootstrap/outputs.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/0-bootstrap/outputs.tf b/0-bootstrap/outputs.tf index 4fb6668..73ba0e2 100644 --- a/0-bootstrap/outputs.tf +++ b/0-bootstrap/outputs.tf @@ -2,6 +2,6 @@ output "tf_state_bucket" { value = aws_s3_bucket.tf_state.bucket } -output "tf_lock_table" { - value = aws_dynamodb_table.tf_lock.name -} +# output "tf_lock_table" { +# value = aws_dynamodb_table.tf_lock.name +# } From b0016e70e1448114188a9e69b695f0038f2ac8e6 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 16:59:54 +0530 Subject: [PATCH 25/34] latest chnages --- 2-eks/backend.tf | 3 ++- markers.json | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 markers.json diff --git a/2-eks/backend.tf b/2-eks/backend.tf index e2e3e0e..503cf76 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -3,7 +3,8 @@ terraform { bucket = "laxmanraju-state-lock" key = "laxmanraju/2-eks/terraform.tfstate" region = "us-east-1" - dynamodb_table = "laxmanraju-state-DB-1-lock" + // dynamodb_table = "laxmanraju-state-DB-1-lock" + use_lockfile = true # replaces dynamodb_table encrypt = true } } diff --git a/markers.json b/markers.json deleted file mode 100644 index 19765bd..0000000 --- a/markers.json +++ /dev/null @@ -1 +0,0 @@ -null From becf5e1e7d4da1f816bbc6b1c9565ad759c16a2a Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 18:07:37 +0530 Subject: [PATCH 26/34] latest chnages --- Jenkinsfile | 368 ++++++++++++++++++++++++++-------------------------- 1 file changed, 186 insertions(+), 182 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 534b863..be996d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,157 +1,3 @@ -// pipeline { - -// parameters { -// choice( -// name: 'terraformAction', -// choices: ['apply', 'destroy'], -// description: 'Choose your terraform action' -// ) -// } - -// environment { -// AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') -// AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') -// AWS_DEFAULT_REGION = 'us-east-1' -// } - -// agent any - -// stages { - -// stage('Checkout') { -// steps { -// script { -// dir('terraform') { -// git url: 'https://github.com/laxmanraju4144/Infrastructure.git', branch: 'main' -// } -// } -// } -// } - -// // ─── APPLY STAGES ───────────────────────────────────────────────────── - -// stage('Plan: 0-bootstrap') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// sh 'cd terraform/0-bootstrap && terraform init -input=false' -// // Import existing resources into state if they already exist in AWS -// // '|| true' ensures pipeline does not fail if resource does not exist yet (first run) -// sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state quantamvector-infra-statefile-backup || true' -// sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' -// sh 'cd terraform/0-bootstrap && terraform plan -out tfplan' -// sh 'cd terraform/0-bootstrap && terraform show -no-color tfplan > tfplan.txt' -// } -// } - -// stage('Approval: 0-bootstrap') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// script { -// def plan = readFile 'terraform/0-bootstrap/tfplan.txt' -// input message: '[0-bootstrap] Approve to proceed', -// parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] -// } -// } -// } - -// stage('Apply: 0-bootstrap') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// sh 'cd terraform/0-bootstrap && terraform apply -input=false tfplan' -// } -// } - -// stage('Plan: 1-network') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// sh 'cd terraform/1-network && terraform init -input=false' -// sh 'cd terraform/1-network && terraform plan -out tfplan' -// sh 'cd terraform/1-network && terraform show -no-color tfplan > tfplan.txt' -// } -// } - -// stage('Approval: 1-network') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// script { -// def plan = readFile 'terraform/1-network/tfplan.txt' -// input message: '[1-network] Approve to proceed', -// parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] -// } -// } -// } - -// stage('Apply: 1-network') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// sh 'cd terraform/1-network && terraform apply -input=false tfplan' -// } -// } - -// stage('Plan: 2-eks') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// sh 'cd terraform/2-eks && terraform init -input=false' -// sh 'cd terraform/2-eks && terraform plan -out tfplan' -// sh 'cd terraform/2-eks && terraform show -no-color tfplan > tfplan.txt' -// } -// } - -// stage('Approval: 2-eks') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// script { -// def plan = readFile 'terraform/2-eks/tfplan.txt' -// input message: '[2-eks] Approve to proceed', -// parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] -// } -// } -// } - -// stage('Apply: 2-eks') { -// when { expression { params.terraformAction == 'apply' } } -// steps { -// sh 'cd terraform/2-eks && terraform apply -input=false tfplan' -// } -// } - -// // ─── DESTROY STAGES (reverse order) ─────────────────────────────────── - -// stage('Destroy: 2-eks') { -// when { expression { params.terraformAction == 'destroy' } } -// steps { -// sh 'cd terraform/2-eks && terraform init -input=false' -// sh 'cd terraform/2-eks && terraform destroy -auto-approve' -// } -// } - -// stage('Destroy: 1-network') { -// when { expression { params.terraformAction == 'destroy' } } -// steps { -// sh 'cd terraform/1-network && terraform init -input=false' -// sh 'cd terraform/1-network && terraform destroy -auto-approve' -// } -// } - -// stage('Destroy: 0-bootstrap') { -// when { expression { params.terraformAction == 'destroy' } } -// steps { -// sh 'cd terraform/0-bootstrap && terraform init -input=false' -// sh 'cd terraform/0-bootstrap && terraform destroy -auto-approve' -// } -// } - -// } - -// post { -// success { -// echo "terraform ${params.terraformAction} completed successfully." -// } -// failure { -// echo "Pipeline failed. Check the stage logs above." -// } -// } -// } pipeline { parameters { @@ -160,11 +6,6 @@ pipeline { choices: ['apply', 'destroy'], description: 'Choose your terraform action' ) - choice( - name: 'initMode', - choices: ['migrate', 'reconfigure'], - description: 'Choose how to handle backend changes' - ) } environment { @@ -192,12 +33,11 @@ pipeline { stage('Plan: 0-bootstrap') { when { expression { params.terraformAction == 'apply' } } steps { - script { - def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' - sh "cd terraform/0-bootstrap && terraform init ${initFlag} -input=false" - } + sh 'cd terraform/0-bootstrap && terraform init -input=false' + // Import existing resources into state if they already exist in AWS + // '|| true' ensures pipeline does not fail if resource does not exist yet (first run) sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state quantamvector-infra-statefile-backup || true' - sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' + // sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' sh 'cd terraform/0-bootstrap && terraform plan -out tfplan' sh 'cd terraform/0-bootstrap && terraform show -no-color tfplan > tfplan.txt' } @@ -224,10 +64,7 @@ pipeline { stage('Plan: 1-network') { when { expression { params.terraformAction == 'apply' } } steps { - script { - def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' - sh "cd terraform/1-network && terraform init ${initFlag} -input=false" - } + sh 'cd terraform/1-network && terraform init -input=false' sh 'cd terraform/1-network && terraform plan -out tfplan' sh 'cd terraform/1-network && terraform show -no-color tfplan > tfplan.txt' } @@ -251,17 +88,39 @@ pipeline { } } - // Continue with 2-eks stages (same pattern)... + stage('Plan: 2-eks') { + when { expression { params.terraformAction == 'apply' } } + steps { + sh 'cd terraform/2-eks && terraform init -input=false' + sh 'cd terraform/2-eks && terraform plan -out tfplan' + sh 'cd terraform/2-eks && terraform show -no-color tfplan > tfplan.txt' + } + } + + stage('Approval: 2-eks') { + when { expression { params.terraformAction == 'apply' } } + steps { + script { + def plan = readFile 'terraform/2-eks/tfplan.txt' + input message: '[2-eks] Approve to proceed', + parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] + } + } + } + + stage('Apply: 2-eks') { + when { expression { params.terraformAction == 'apply' } } + steps { + sh 'cd terraform/2-eks && terraform apply -input=false tfplan' + } + } - // ─── DESTROY STAGES ─────────────────────────────────────────────────── + // ─── DESTROY STAGES (reverse order) ─────────────────────────────────── stage('Destroy: 2-eks') { when { expression { params.terraformAction == 'destroy' } } steps { - script { - def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' - sh "cd terraform/2-eks && terraform init ${initFlag} -input=false" - } + sh 'cd terraform/2-eks && terraform init -input=false' sh 'cd terraform/2-eks && terraform destroy -auto-approve' } } @@ -269,10 +128,7 @@ pipeline { stage('Destroy: 1-network') { when { expression { params.terraformAction == 'destroy' } } steps { - script { - def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' - sh "cd terraform/1-network && terraform init ${initFlag} -input=false" - } + sh 'cd terraform/1-network && terraform init -input=false' sh 'cd terraform/1-network && terraform destroy -auto-approve' } } @@ -280,13 +136,11 @@ pipeline { stage('Destroy: 0-bootstrap') { when { expression { params.terraformAction == 'destroy' } } steps { - script { - def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' - sh "cd terraform/0-bootstrap && terraform init ${initFlag} -input=false" - } + sh 'cd terraform/0-bootstrap && terraform init -input=false' sh 'cd terraform/0-bootstrap && terraform destroy -auto-approve' } } + } post { @@ -298,3 +152,153 @@ pipeline { } } } + + + + +//pipeline { + +// parameters { +// choice( +// name: 'terraformAction', +// choices: ['apply', 'destroy'], +// description: 'Choose your terraform action' +// ) +// choice( +// name: 'initMode', +// choices: ['migrate', 'reconfigure'], +// description: 'Choose how to handle backend changes' +// ) +// } + +// environment { +// AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') +// AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') +// AWS_DEFAULT_REGION = 'us-east-1' +// } + +// agent any + +// stages { + +// stage('Checkout') { +// steps { +// script { +// dir('terraform') { +// git url: 'https://github.com/laxmanraju4144/Infrastructure.git', branch: 'main' +// } +// } +// } +// } + +// // ─── APPLY STAGES ───────────────────────────────────────────────────── + +// stage('Plan: 0-bootstrap') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// script { +// def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' +// sh "cd terraform/0-bootstrap && terraform init ${initFlag} -input=false" +// } +// sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state quantamvector-infra-statefile-backup || true' +// sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' +// sh 'cd terraform/0-bootstrap && terraform plan -out tfplan' +// sh 'cd terraform/0-bootstrap && terraform show -no-color tfplan > tfplan.txt' +// } +// } + +// stage('Approval: 0-bootstrap') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// script { +// def plan = readFile 'terraform/0-bootstrap/tfplan.txt' +// input message: '[0-bootstrap] Approve to proceed', +// parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] +// } +// } +// } + +// stage('Apply: 0-bootstrap') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// sh 'cd terraform/0-bootstrap && terraform apply -input=false tfplan' +// } +// } + +// stage('Plan: 1-network') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// script { +// def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' +// sh "cd terraform/1-network && terraform init ${initFlag} -input=false" +// } +// sh 'cd terraform/1-network && terraform plan -out tfplan' +// sh 'cd terraform/1-network && terraform show -no-color tfplan > tfplan.txt' +// } +// } + +// stage('Approval: 1-network') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// script { +// def plan = readFile 'terraform/1-network/tfplan.txt' +// input message: '[1-network] Approve to proceed', +// parameters: [text(name: 'Plan', description: 'Terraform Plan Output', defaultValue: plan)] +// } +// } +// } + +// stage('Apply: 1-network') { +// when { expression { params.terraformAction == 'apply' } } +// steps { +// sh 'cd terraform/1-network && terraform apply -input=false tfplan' +// } +// } + +// // Continue with 2-eks stages (same pattern)... + +// // ─── DESTROY STAGES ─────────────────────────────────────────────────── + +// stage('Destroy: 2-eks') { +// when { expression { params.terraformAction == 'destroy' } } +// steps { +// script { +// def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' +// sh "cd terraform/2-eks && terraform init ${initFlag} -input=false" +// } +// sh 'cd terraform/2-eks && terraform destroy -auto-approve' +// } +// } + +// stage('Destroy: 1-network') { +// when { expression { params.terraformAction == 'destroy' } } +// steps { +// script { +// def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' +// sh "cd terraform/1-network && terraform init ${initFlag} -input=false" +// } +// sh 'cd terraform/1-network && terraform destroy -auto-approve' +// } +// } + +// stage('Destroy: 0-bootstrap') { +// when { expression { params.terraformAction == 'destroy' } } +// steps { +// script { +// def initFlag = params.initMode == 'migrate' ? '-migrate-state' : '-reconfigure' +// sh "cd terraform/0-bootstrap && terraform init ${initFlag} -input=false" +// } +// sh 'cd terraform/0-bootstrap && terraform destroy -auto-approve' +// } +// } +// } + +// post { +// success { +// echo "terraform ${params.terraformAction} completed successfully." +// } +// failure { +// echo "Pipeline failed. Check the stage logs above." +// } +// } +// } From f2a1e5f3d07e21958dc78b92597042a03e81a84e Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 18:55:30 +0530 Subject: [PATCH 27/34] latets chnages --- 0-bootstrap/.terraform.lock.hcl | 25 ------- 0-bootstrap/main.tf | 4 +- 2-eks/.terraform.lock.hcl | 105 ----------------------------- 2-eks/.terraform/terraform.tfstate | 55 --------------- Jenkinsfile | 2 +- 5 files changed, 3 insertions(+), 188 deletions(-) delete mode 100644 0-bootstrap/.terraform.lock.hcl delete mode 100644 2-eks/.terraform.lock.hcl delete mode 100644 2-eks/.terraform/terraform.tfstate diff --git a/0-bootstrap/.terraform.lock.hcl b/0-bootstrap/.terraform.lock.hcl deleted file mode 100644 index 92a2bcc..0000000 --- a/0-bootstrap/.terraform.lock.hcl +++ /dev/null @@ -1,25 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "5.100.0" - constraints = "~> 5.0" - hashes = [ - "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", - "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", - "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", - "zh:1589a2266af699cbd5d80737a0fe02e54ec9cf2ca54e7e00ac51c7359056f274", - "zh:6330766f1d85f01ae6ea90d1b214b8b74cc8c1badc4696b165b36ddd4cc15f7b", - "zh:7c8c2e30d8e55291b86fcb64bdf6c25489d538688545eb48fd74ad622e5d3862", - "zh:99b1003bd9bd32ee323544da897148f46a527f622dc3971af63ea3e251596342", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9f8b909d3ec50ade83c8062290378b1ec553edef6a447c56dadc01a99f4eaa93", - "zh:aaef921ff9aabaf8b1869a86d692ebd24fbd4e12c21205034bb679b9caf883a2", - "zh:ac882313207aba00dd5a76dbd572a0ddc818bb9cbf5c9d61b28fe30efaec951e", - "zh:bb64e8aff37becab373a1a0cc1080990785304141af42ed6aa3dd4913b000421", - "zh:dfe495f6621df5540d9c92ad40b8067376350b005c637ea6efac5dc15028add4", - "zh:f0ddf0eaf052766cfe09dea8200a946519f653c384ab4336e2a4a64fdd6310e9", - "zh:f1b7e684f4c7ae1eed272b6de7d2049bb87a0275cb04dbb7cda6636f600699c9", - "zh:ff461571e3f233699bf690db319dfe46aec75e58726636a0d97dd9ac6e32fb70", - ] -} diff --git a/0-bootstrap/main.tf b/0-bootstrap/main.tf index af5fa24..8477cd4 100644 --- a/0-bootstrap/main.tf +++ b/0-bootstrap/main.tf @@ -1,10 +1,10 @@ resource "aws_s3_bucket" "tf_state" { - bucket = "laxmanraju-state-lock" + bucket = "laxmanraju-statefile-logs" } resource "aws_s3_bucket_versioning" "tf_state" { bucket = aws_s3_bucket.tf_state.id - + versioning_configuration { status = "Enabled" } diff --git a/2-eks/.terraform.lock.hcl b/2-eks/.terraform.lock.hcl deleted file mode 100644 index 8e83589..0000000 --- a/2-eks/.terraform.lock.hcl +++ /dev/null @@ -1,105 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "5.100.0" - constraints = ">= 4.33.0, ~> 5.0, >= 5.95.0, < 6.0.0" - hashes = [ - "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", - "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", - "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", - "zh:1589a2266af699cbd5d80737a0fe02e54ec9cf2ca54e7e00ac51c7359056f274", - "zh:6330766f1d85f01ae6ea90d1b214b8b74cc8c1badc4696b165b36ddd4cc15f7b", - "zh:7c8c2e30d8e55291b86fcb64bdf6c25489d538688545eb48fd74ad622e5d3862", - "zh:99b1003bd9bd32ee323544da897148f46a527f622dc3971af63ea3e251596342", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9f8b909d3ec50ade83c8062290378b1ec553edef6a447c56dadc01a99f4eaa93", - "zh:aaef921ff9aabaf8b1869a86d692ebd24fbd4e12c21205034bb679b9caf883a2", - "zh:ac882313207aba00dd5a76dbd572a0ddc818bb9cbf5c9d61b28fe30efaec951e", - "zh:bb64e8aff37becab373a1a0cc1080990785304141af42ed6aa3dd4913b000421", - "zh:dfe495f6621df5540d9c92ad40b8067376350b005c637ea6efac5dc15028add4", - "zh:f0ddf0eaf052766cfe09dea8200a946519f653c384ab4336e2a4a64fdd6310e9", - "zh:f1b7e684f4c7ae1eed272b6de7d2049bb87a0275cb04dbb7cda6636f600699c9", - "zh:ff461571e3f233699bf690db319dfe46aec75e58726636a0d97dd9ac6e32fb70", - ] -} - -provider "registry.terraform.io/hashicorp/cloudinit" { - version = "2.3.7" - constraints = ">= 2.0.0" - hashes = [ - "h1:M9TpQxKAE/hyOwytdX9MUNZw30HoD/OXqYIug5fkqH8=", - "zh:06f1c54e919425c3139f8aeb8fcf9bceca7e560d48c9f0c1e3bb0a8ad9d9da1e", - "zh:0e1e4cf6fd98b019e764c28586a386dc136129fef50af8c7165a067e7e4a31d5", - "zh:1871f4337c7c57287d4d67396f633d224b8938708b772abfc664d1f80bd67edd", - "zh:2b9269d91b742a71b2248439d5e9824f0447e6d261bfb86a8a88528609b136d1", - "zh:3d8ae039af21426072c66d6a59a467d51f2d9189b8198616888c1b7fc42addc7", - "zh:3ef4e2db5bcf3e2d915921adced43929214e0946a6fb11793085d9a48995ae01", - "zh:42ae54381147437c83cbb8790cc68935d71b6357728a154109d3220b1beb4dc9", - "zh:4496b362605ae4cbc9ef7995d102351e2fe311897586ffc7a4a262ccca0c782a", - "zh:652a2401257a12706d32842f66dac05a735693abcb3e6517d6b5e2573729ba13", - "zh:7406c30806f5979eaed5f50c548eced2ea18ea121e01801d2f0d4d87a04f6a14", - "zh:7848429fd5a5bcf35f6fee8487df0fb64b09ec071330f3ff240c0343fe2a5224", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - ] -} - -provider "registry.terraform.io/hashicorp/null" { - version = "3.2.4" - constraints = ">= 3.0.0" - hashes = [ - "h1:L5V05xwp/Gto1leRryuesxjMfgZwjb7oool4WS1UEFQ=", - "zh:59f6b52ab4ff35739647f9509ee6d93d7c032985d9f8c6237d1f8a59471bbbe2", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:795c897119ff082133150121d39ff26cb5f89a730a2c8c26f3a9c1abf81a9c43", - "zh:7b9c7b16f118fbc2b05a983817b8ce2f86df125857966ad356353baf4bff5c0a", - "zh:85e33ab43e0e1726e5f97a874b8e24820b6565ff8076523cc2922ba671492991", - "zh:9d32ac3619cfc93eb3c4f423492a8e0f79db05fec58e449dee9b2d5873d5f69f", - "zh:9e15c3c9dd8e0d1e3731841d44c34571b6c97f5b95e8296a45318b94e5287a6e", - "zh:b4c2ab35d1b7696c30b64bf2c0f3a62329107bd1a9121ce70683dec58af19615", - "zh:c43723e8cc65bcdf5e0c92581dcbbdcbdcf18b8d2037406a5f2033b1e22de442", - "zh:ceb5495d9c31bfb299d246ab333f08c7fb0d67a4f82681fbf47f2a21c3e11ab5", - "zh:e171026b3659305c558d9804062762d168f50ba02b88b231d20ec99578a6233f", - "zh:ed0fe2acdb61330b01841fa790be00ec6beaac91d41f311fb8254f74eb6a711f", - ] -} - -provider "registry.terraform.io/hashicorp/time" { - version = "0.13.1" - constraints = ">= 0.9.0" - hashes = [ - "h1:ZT5ppCNIModqk3iOkVt5my8b8yBHmDpl663JtXAIRqM=", - "zh:02cb9aab1002f0f2a94a4f85acec8893297dc75915f7404c165983f720a54b74", - "zh:04429b2b31a492d19e5ecf999b116d396dac0b24bba0d0fb19ecaefe193fdb8f", - "zh:26f8e51bb7c275c404ba6028c1b530312066009194db721a8427a7bc5cdbc83a", - "zh:772ff8dbdbef968651ab3ae76d04afd355c32f8a868d03244db3f8496e462690", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:898db5d2b6bd6ca5457dccb52eedbc7c5b1a71e4a4658381bcbb38cedbbda328", - "zh:8de913bf09a3fa7bedc29fec18c47c571d0c7a3d0644322c46f3aa648cf30cd8", - "zh:9402102c86a87bdfe7e501ffbb9c685c32bbcefcfcf897fd7d53df414c36877b", - "zh:b18b9bb1726bb8cfbefc0a29cf3657c82578001f514bcf4c079839b6776c47f0", - "zh:b9d31fdc4faecb909d7c5ce41d2479dd0536862a963df434be4b16e8e4edc94d", - "zh:c951e9f39cca3446c060bd63933ebb89cedde9523904813973fbc3d11863ba75", - "zh:e5b773c0d07e962291be0e9b413c7a22c044b8c7b58c76e8aa91d1659990dfb5", - ] -} - -provider "registry.terraform.io/hashicorp/tls" { - version = "4.2.1" - constraints = ">= 3.0.0" - hashes = [ - "h1:akFNuHwvrtnYMBofieoeXhPJDhYZzJVu/Q/BgZK2fgg=", - "zh:0d1e7d07ac973b97fa228f46596c800de830820506ee145626f079dd6bbf8d8a", - "zh:5c7e3d4348cb4861ab812973ef493814a4b224bdd3e9d534a7c8a7c992382b86", - "zh:7c6d4a86cd7a4e9c1025c6b3a3a6a45dea202af85d870cddbab455fb1bd568ad", - "zh:7d0864755ba093664c4b2c07c045d3f5e3d7c799dda1a3ef33d17ed1ac563191", - "zh:83734f57950ab67c0d6a87babdb3f13c908cbe0a48949333f489698532e1391b", - "zh:951e3c285218ebca0cf20eaa4265020b4ef042fea9c6ade115ad1558cfe459e5", - "zh:b9543955b4297e1d93b85900854891c0e645d936d8285a190030475379c5c635", - "zh:bb1bd9e86c003d08c30c1b00d44118ed5bbbf6b1d2d6f7eaac4fa5c6ebea5933", - "zh:c9477bfe00653629cd77ddac3968475f7ad93ac3ca8bc45b56d1d9efb25e4a6e", - "zh:d4cfda8687f736d0cba664c22ec49dae1188289e214ef57f5afe6a7217854fed", - "zh:dc77ee066cf96532a48f0578c35b1eaf6dc4d8ddd0e3ae8e029a3b10676dd5d3", - "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - ] -} diff --git a/2-eks/.terraform/terraform.tfstate b/2-eks/.terraform/terraform.tfstate deleted file mode 100644 index b6fc81c..0000000 --- a/2-eks/.terraform/terraform.tfstate +++ /dev/null @@ -1,55 +0,0 @@ -{ - "version": 3, - "terraform_version": "1.10.3", - "backend": { - "type": "s3", - "config": { - "access_key": null, - "acl": null, - "allowed_account_ids": null, - "assume_role": null, - "assume_role_with_web_identity": null, - "bucket": "laxmanraju-state-lock", - "custom_ca_bundle": null, - "dynamodb_endpoint": null, - "dynamodb_table": "laxmanraju-statefile-backup", - "ec2_metadata_service_endpoint": null, - "ec2_metadata_service_endpoint_mode": null, - "encrypt": true, - "endpoint": null, - "endpoints": null, - "forbidden_account_ids": null, - "force_path_style": null, - "http_proxy": null, - "https_proxy": null, - "iam_endpoint": null, - "insecure": null, - "key": "laxmanraju/2-eks/terraform.tfstate", - "kms_key_id": null, - "max_retries": null, - "no_proxy": null, - "profile": null, - "region": "us-east-1", - "retry_mode": null, - "secret_key": null, - "shared_config_files": null, - "shared_credentials_file": null, - "shared_credentials_files": null, - "skip_credentials_validation": null, - "skip_metadata_api_check": null, - "skip_region_validation": null, - "skip_requesting_account_id": null, - "skip_s3_checksum": null, - "sse_customer_key": null, - "sts_endpoint": null, - "sts_region": null, - "token": null, - "use_dualstack_endpoint": null, - "use_fips_endpoint": null, - "use_lockfile": null, - "use_path_style": null, - "workspace_key_prefix": null - }, - "hash": 2092075295 - } -} \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index be996d3..7a3ac4c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ pipeline { sh 'cd terraform/0-bootstrap && terraform init -input=false' // Import existing resources into state if they already exist in AWS // '|| true' ensures pipeline does not fail if resource does not exist yet (first run) - sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state quantamvector-infra-statefile-backup || true' + sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state laxmanraju-statefile-logs || true' // sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' sh 'cd terraform/0-bootstrap && terraform plan -out tfplan' sh 'cd terraform/0-bootstrap && terraform show -no-color tfplan > tfplan.txt' From 07721d8da177706975f44414df729a5dff798c19 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 19:14:22 +0530 Subject: [PATCH 28/34] latest chnages --- 1-network/backend.tf | 2 +- 2-eks/backend.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/1-network/backend.tf b/1-network/backend.tf index 32cfda9..1898271 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -10,7 +10,7 @@ terraform { backend "s3" { - bucket = "laxmanraju-state-lock" # your S3 bucket + bucket = "laxmanraju-statefile-logs" # your S3 bucket key = "env/terraform.tfstate" # path inside the bucket region = "us-east-1" encrypt = true diff --git a/2-eks/backend.tf b/2-eks/backend.tf index 503cf76..d3a9cc9 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -1,6 +1,6 @@ terraform { backend "s3" { - bucket = "laxmanraju-state-lock" + bucket = "laxmanraju-statefile-logs" key = "laxmanraju/2-eks/terraform.tfstate" region = "us-east-1" // dynamodb_table = "laxmanraju-state-DB-1-lock" From 22513dcea8b0e9bbac41c962b7e5c4868c195583 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 19:22:52 +0530 Subject: [PATCH 29/34] latest chnages --- 2-eks/data.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-eks/data.tf b/2-eks/data.tf index 57ef006..c4aa83d 100644 --- a/2-eks/data.tf +++ b/2-eks/data.tf @@ -2,7 +2,7 @@ data "terraform_remote_state" "network" { backend = "s3" config = { - bucket = "laxmanraju-state-lock" + bucket = "laxmanraju-statefile-logs" key = "laxmanraju/1-network/terraform.tfstate" region = "us-east-1" } From 724fc164a298b11f7e61fa586adc420aef6d6ef5 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 19:25:33 +0530 Subject: [PATCH 30/34] latest chnages --- 2-eks/data.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-eks/data.tf b/2-eks/data.tf index c4aa83d..3a63e75 100644 --- a/2-eks/data.tf +++ b/2-eks/data.tf @@ -3,7 +3,7 @@ data "terraform_remote_state" "network" { config = { bucket = "laxmanraju-statefile-logs" - key = "laxmanraju/1-network/terraform.tfstate" + key = "env/terraform.tfstate" region = "us-east-1" } } From df2aed4a02acf69b0717b037889f5e2a9ccbd1a8 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 19:34:34 +0530 Subject: [PATCH 31/34] latest changes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7a3ac4c..5117651 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ pipeline { sh 'cd terraform/0-bootstrap && terraform init -input=false' // Import existing resources into state if they already exist in AWS // '|| true' ensures pipeline does not fail if resource does not exist yet (first run) - sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state laxmanraju-statefile-logs || true' + // sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state laxmanraju-statefile-logs || true' // sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' sh 'cd terraform/0-bootstrap && terraform plan -out tfplan' sh 'cd terraform/0-bootstrap && terraform show -no-color tfplan > tfplan.txt' From 1f0a5498f93f1fb0c5fc0ae7d032d809cecefbd3 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 19:44:17 +0530 Subject: [PATCH 32/34] latest chnage --- 1-network/variables.tf | 2 +- 2-eks/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/1-network/variables.tf b/1-network/variables.tf index 79580fd..3e7090e 100644 --- a/1-network/variables.tf +++ b/1-network/variables.tf @@ -1,6 +1,6 @@ variable "project" { type = string - default = "microservices" + default = "microservices-v2" } variable "vpc_cidr" { diff --git a/2-eks/variables.tf b/2-eks/variables.tf index c916508..bfb12aa 100644 --- a/2-eks/variables.tf +++ b/2-eks/variables.tf @@ -1,6 +1,6 @@ variable "project" { type = string - default = "microservices" + default = "microservices-v2" } variable "kubernetes_version" { From 7a82563437097b151ac5fa29f93de8c0e7fb4a68 Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 19:50:44 +0530 Subject: [PATCH 33/34] latets chnages --- 0-bootstrap/main.tf | 20 ++++++++++---------- 0-bootstrap/outputs.tf | 6 +++--- 1-network/backend.tf | 3 ++- 2-eks/backend.tf | 2 +- Jenkinsfile | 4 ++-- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/0-bootstrap/main.tf b/0-bootstrap/main.tf index 8477cd4..c420850 100644 --- a/0-bootstrap/main.tf +++ b/0-bootstrap/main.tf @@ -29,15 +29,15 @@ resource "aws_s3_bucket_public_access_block" "tf_state" { restrict_public_buckets = true } -# resource "aws_dynamodb_table" "tf_lock" { -# name = "laxmanraju-state-DB-1-lock" -# billing_mode = "PAY_PER_REQUEST" -# hash_key = "LockID" - -# attribute { -# name = "LockID" -# type = "S" -# } -# } +resource "aws_dynamodb_table" "tf_lock" { + name = "laxmanraju-statefile-DB-lock" + billing_mode = "PAY_PER_REQUEST" + hash_key = "LockID" + + attribute { + name = "LockID" + type = "S" + } +} //updated \ No newline at end of file diff --git a/0-bootstrap/outputs.tf b/0-bootstrap/outputs.tf index 73ba0e2..4fb6668 100644 --- a/0-bootstrap/outputs.tf +++ b/0-bootstrap/outputs.tf @@ -2,6 +2,6 @@ output "tf_state_bucket" { value = aws_s3_bucket.tf_state.bucket } -# output "tf_lock_table" { -# value = aws_dynamodb_table.tf_lock.name -# } +output "tf_lock_table" { + value = aws_dynamodb_table.tf_lock.name +} diff --git a/1-network/backend.tf b/1-network/backend.tf index 1898271..c2a12d1 100644 --- a/1-network/backend.tf +++ b/1-network/backend.tf @@ -11,7 +11,8 @@ terraform { backend "s3" { bucket = "laxmanraju-statefile-logs" # your S3 bucket - key = "env/terraform.tfstate" # path inside the bucket + key = "env/terraform.tfstate" + dynamodbdynamodb_table = "laxmanraju-statefile-DB-lock" # path inside the bucket region = "us-east-1" encrypt = true use_lockfile = true # replaces dynamodb_table diff --git a/2-eks/backend.tf b/2-eks/backend.tf index d3a9cc9..af892a3 100644 --- a/2-eks/backend.tf +++ b/2-eks/backend.tf @@ -3,7 +3,7 @@ terraform { bucket = "laxmanraju-statefile-logs" key = "laxmanraju/2-eks/terraform.tfstate" region = "us-east-1" - // dynamodb_table = "laxmanraju-state-DB-1-lock" + dynamodb_table = "laxmanraju-statefile-DB-lock" use_lockfile = true # replaces dynamodb_table encrypt = true } diff --git a/Jenkinsfile b/Jenkinsfile index 5117651..ea63b31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,8 +36,8 @@ pipeline { sh 'cd terraform/0-bootstrap && terraform init -input=false' // Import existing resources into state if they already exist in AWS // '|| true' ensures pipeline does not fail if resource does not exist yet (first run) - // sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state laxmanraju-statefile-logs || true' - // sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock quantamvector-terraform-locks || true' + sh 'cd terraform/0-bootstrap && terraform import aws_s3_bucket.tf_state laxmanraju-statefile-logs || true' + sh 'cd terraform/0-bootstrap && terraform import aws_dynamodb_table.tf_lock laxmanraju-statefile-DB-lock || true' sh 'cd terraform/0-bootstrap && terraform plan -out tfplan' sh 'cd terraform/0-bootstrap && terraform show -no-color tfplan > tfplan.txt' } From a6274a331c92630bd58201024108f37db42adc6e Mon Sep 17 00:00:00 2001 From: Gitops+Project Date: Tue, 5 May 2026 20:00:00 +0530 Subject: [PATCH 34/34] latets chnages --- Jenkinsfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ea63b31..741ba25 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -88,10 +88,18 @@ pipeline { } } + // stage('Plan: 2-eks') { + // when { expression { params.terraformAction == 'apply' } } + // steps { + // sh 'cd terraform/2-eks && terraform init -input=false' + // sh 'cd terraform/2-eks && terraform plan -out tfplan' + // sh 'cd terraform/2-eks && terraform show -no-color tfplan > tfplan.txt' + // } + // } stage('Plan: 2-eks') { when { expression { params.terraformAction == 'apply' } } steps { - sh 'cd terraform/2-eks && terraform init -input=false' + sh 'cd terraform/2-eks && terraform init -reconfigure -input=false' sh 'cd terraform/2-eks && terraform plan -out tfplan' sh 'cd terraform/2-eks && terraform show -no-color tfplan > tfplan.txt' }