Skip to content

Commit

Permalink
Added cidr subnet function
Browse files Browse the repository at this point in the history
  • Loading branch information
qtsathish committed Mar 2, 2021
1 parent 0bb4259 commit 50151de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Feb21/ntier-tf-aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource "aws_vpc" "ntiervpc" {
resource "aws_subnet" "subnets" {
count = 6
vpc_id = aws_vpc.ntiervpc.id
cidr_block = var.cidrranges[count.index]
cidr_block = cidrsubnet(var.vpccidr,8,count.index)
availability_zone = var.subnetazs[count.index]

tags = {
Expand Down
7 changes: 1 addition & 6 deletions Feb21/ntier-tf-aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ variable "subnets" {
description = "Name of the subnets"
}

variable "cidrranges" {
type = list(string)
default = ["192.168.0.0/24","192.168.1.0/24","192.168.2.0/24", "192.168.3.0/24", "192.168.4.0/24", "192.168.5.0/24"]
description = "cidr ranges of the subnets"

}

variable "subnetazs" {
type = list(string)
default = ["us-west-2a","us-west-2b","us-west-2a","us-west-2b","us-west-2a","us-west-2b"]
Expand Down

0 comments on commit 50151de

Please sign in to comment.