Skip to content

Commit

Permalink
Merge pull request #10 from kunduso/add-scaffolding
Browse files Browse the repository at this point in the history
Expand VPC
  • Loading branch information
kunduso authored Aug 24, 2024
2 parents f00f583 + 00a2377 commit 6c91dd0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions network.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc
resource "aws_vpc" "this" {
#checkov:skip=CKV2_AWS_11: This is non prod and hence disabled.
cidr_block = var.vpc_cidr
Expand All @@ -8,24 +9,26 @@ resource "aws_vpc" "this" {
"Name" = "${var.name}"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet
resource "aws_subnet" "db" {
count = length(var.subnet_cidr)
count = length(var.subnet_cidr_db)
vpc_id = aws_vpc.this.id
cidr_block = var.subnet_cidr[count.index]
cidr_block = var.subnet_cidr_db[count.index]
availability_zone = data.aws_availability_zones.available.names[count.index]
tags = {
"Name" = "${var.name}subnet-${count.index + 1}"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table
resource "aws_route_table" "this_rt" {
vpc_id = aws_vpc.this.id
tags = {
"Name" = "${var.name}-route-table"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table_association
resource "aws_route_table_association" "db" {
count = length(var.subnet_cidr)
count = length(var.subnet_cidr_db)
subnet_id = element(aws_subnet.db.*.id, count.index)
route_table_id = aws_route_table.this_rt.id
}

}
2 changes: 1 addition & 1 deletion provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provider "aws" {
secret_key = var.secret_key
default_tags {
tags = {
Source = "https://github.com/kunduso/terraform-rds-secretsmanager-rotation-lambda"
Source = "https://github.com/kunduso/rds-secretsmanager-rotation-lambda-terraform"
}
}
}
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ variable "name" {
variable "vpc_cidr" {
description = "The CIDR of the VPC."
type = string
default = "15.25.15.0/27"
default = "15.25.15.0/26"
}
variable "subnet_cidr" {
variable "subnet_cidr_db" {
description = "The CIDR blocks for the subnets."
type = list(any)
default = ["15.25.15.0/28", "15.25.15.16/28"]
Expand Down

0 comments on commit 6c91dd0

Please sign in to comment.