Skip to content

Commit

Permalink
Merge pull request #9 from storyprotocol/feat/provision_vpc
Browse files Browse the repository at this point in the history
[feat] create a vpc
  • Loading branch information
AndyBoWu authored May 8, 2024
2 parents fc7a70e + af708bb commit fdc010b
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
4 changes: 4 additions & 0 deletions infra/s3/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module "s3-bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "4.1.2"
}
3 changes: 3 additions & 0 deletions infra/s3/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "bucket_id" {
value = module.s3-bucket.s3_bucket_id
}
4 changes: 4 additions & 0 deletions infra/s3/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "bucket_name" {
description = "The name of the bucket."
type = string
}
26 changes: 26 additions & 0 deletions infra/vpc/main.tf
Original file line number Diff line number Diff line change
@@ -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

}
14 changes: 14 additions & 0 deletions infra/vpc/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
output "vpc_id" {
value = module.vpc.vpc_id
description = "The ID of the VPC created."
}

output "public_subnet_ids" {
value = module.vpc.public_subnet_ids
description = "List of IDs of public subnets."
}

output "private_subnet_ids" {
value = module.vpc.private_subnet_ids
description = "List of IDs of private subnets."
}
34 changes: 34 additions & 0 deletions infra/vpc/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
variable "name" {
description = "Name of the VPC"
type = string
}

variable "cidr" {
description = "CIDR block for the VPC"
type = string
}

variable "azs" {
description = "Availability Zones to use for the subnets"
type = list(string)
}

variable "private_subnets" {
description = "List of private subnet CIDRs"
type = list(string)
}

variable "public_subnets" {
description = "List of public subnet CIDRs"
type = list(string)
}

variable "enable_nat_gateway" {
description = "Should be true if NAT gateway should be created"
type = bool
}

variable "enable_vpn_gateway" {
description = "Should be true if VPN gateway should be created"
type = bool
}

0 comments on commit fdc010b

Please sign in to comment.