From d37a4bfc3be45b0c445499715e31436d9a104075 Mon Sep 17 00:00:00 2001 From: Andy Wu Date: Tue, 7 May 2024 17:03:39 -0700 Subject: [PATCH 1/2] [feat] create a vpc --- infra/vpc/main.tf | 26 ++++++++++++++++++++++++++ infra/vpc/output.tf | 7 +++++++ infra/vpc/variables.tf | 9 +++++++++ 3 files changed, 42 insertions(+) diff --git a/infra/vpc/main.tf b/infra/vpc/main.tf index e69de29..f77a2e3 100644 --- a/infra/vpc/main.tf +++ b/infra/vpc/main.tf @@ -0,0 +1,26 @@ +# Filter out local zones not currently supported +# with managed node groups +data "aws_availability_zones" "available" { + filter { + name = "opt-in-status" + values = ["opt-in-not-required"] + } +} + +module "iac-max-vpc" { + source = "terraform-aws-modules/vpc/aws" + version = "5.0.0" + + name = "iac-max-vpc" + + cidr = "10.0.0.0/16" + azs = slice(data.aws_availability_zones.available.names, 0, 3) + + private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] + public_subnets = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"] + + enable_nat_gateway = true + single_nat_gateway = true + enable_dns_hostnames = true + +} diff --git a/infra/vpc/output.tf b/infra/vpc/output.tf index e69de29..f80c602 100644 --- a/infra/vpc/output.tf +++ b/infra/vpc/output.tf @@ -0,0 +1,7 @@ +output "vpc_id" { + value = module.this.vpc_id +} + +output "private_subnets" { + value = module.this.private_subnets +} diff --git a/infra/vpc/variables.tf b/infra/vpc/variables.tf index e69de29..4b7c6e5 100644 --- a/infra/vpc/variables.tf +++ b/infra/vpc/variables.tf @@ -0,0 +1,9 @@ +variable "cidr" { + type = string + default = "10.0.0.0/16" +} + +variable "cluster_name" { + description = "The name of the EKS cluster" + type = string +} From 2428ef0cd8517f5f315bc10a6823970febaa4b3b Mon Sep 17 00:00:00 2001 From: AndyBoWu Date: Wed, 8 May 2024 02:50:11 +0000 Subject: [PATCH 2/2] Automated Terraform format corrections --- infra/vpc/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/vpc/variables.tf b/infra/vpc/variables.tf index 4b7c6e5..72b0b63 100644 --- a/infra/vpc/variables.tf +++ b/infra/vpc/variables.tf @@ -5,5 +5,5 @@ variable "cidr" { variable "cluster_name" { description = "The name of the EKS cluster" - type = string + type = string }