🎯 Setting up the main networking components (VPCs, Subnets, Security Groups & VPC Endpoints) for our EKS cluster
, including: EKS VPC & CI/CD VPC.
👉Variables in environment/dev/.env
source environment/dev/.env
export TF_VAR_fully_private_cluster=false
export TF_VAR_vpc_type=$VPC_TYPE_PRIVATE
export TF_VAR_vpc_name=$TF_VAR_vpc_eks_name
export TF_VAR_vpc_cidr=$TF_VAR_vpc_public_eks_cidr
export TF_VAR_vpc_public_subnets=$TF_VAR_vpc_public_eks_public_subnets
export TF_VAR_vpc_private_subnets=$TF_VAR_vpc_public_eks_private_subnets
cd modules/vpc-advanced
terraform init -reconfigure -backend-config="region=${AWS_REGION}" \
-backend-config="bucket=${TF_STATE_S3_BUCKET}" \
-backend-config="key=${PROJECT_ID}-vpc-eks.tfstate" \
-backend-config="dynamodb_table=${TF_STATE_DYNAMODB_TABLE}"
terraform plan -out tfplan
terraform apply -input=false -auto-approve tfplan
cd ../..
export TF_VAR_vpc_type=$VPC_TYPE_STANDARD
export TF_VAR_vpc_name=$TF_VAR_vpc_cicd_name
export TF_VAR_vpc_cidr=$TF_VAR_vpc_cicd_cidr
export TF_VAR_vpc_public_subnets=$TF_VAR_vpc_cicd_public_subnets
export TF_VAR_vpc_private_subnets=$TF_VAR_vpc_cicd_private_subnets
cd modules/vpc-private
terraform init -reconfigure -backend-config="region=${AWS_REGION}" \
-backend-config="bucket=${TF_STATE_S3_BUCKET}" \
-backend-config="key=${PROJECT_ID}-vpc-cicd.tfstate" \
-backend-config="dynamodb_table=${TF_STATE_DYNAMODB_TABLE}"
terraform plan -out tfplan
terraform apply -input=false -auto-approve tfplan
cd ../..
export TF_VAR_vpc_type=$VPC_TYPE_STANDARD
export TF_VAR_vpc_name=$TF_VAR_vpc_cicd_name
export TF_VAR_vpc_cidr=$TF_VAR_vpc_cicd_cidr
export TF_VAR_vpc_public_subnets=$TF_VAR_vpc_cicd_public_subnets
export TF_VAR_vpc_private_subnets=$TF_VAR_vpc_cicd_private_subnets
cd modules/vpc
terraform init -reconfigure -backend-config="region=${AWS_REGION}" \
-backend-config="bucket=${TF_STATE_S3_BUCKET}" \
-backend-config="key=${PROJECT_ID}-vpc-cicd.tfstate" \
-backend-config="dynamodb_table=${TF_STATE_DYNAMODB_TABLE}"
terraform plan -out tfplan
terraform apply -input=false -auto-approve tfplan
cd ../..