Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand VPC #10

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading