File tree Expand file tree Collapse file tree 2 files changed +7
-25
lines changed Expand file tree Collapse file tree 2 files changed +7
-25
lines changed Original file line number Diff line number Diff line change 11# Find the available availability zones
22data "aws_availability_zones" "available" {
3+ blacklisted_names = var. blacklisted_names
34}
45
56data "aws_vpc" "current" {
67 id = var. vpc_id
78}
89
9- locals {
10- default_az_to_netnum = {
11- a = 1
12- b = 2
13- c = 3
14- d = 4
15- e = 5
16- f = 6
17- }
18- }
19-
20- data "template_file" "az_to_netnum" {
21- count = length (data. aws_availability_zones . available . names )
22- template = " $${netnum}"
23-
24- vars = {
25- netnum = local.default_az_to_netnum[substr (
26- element (data. aws_availability_zones . available . names , count. index ),
27- - 1 ,
28- 1 ,
29- )]
30- }
31- }
32-
3310resource "aws_route_table" "mod" {
3411 tags = var. tags
3512 vpc_id = var. vpc_id
@@ -48,7 +25,7 @@ resource "aws_subnet" "mod" {
4825 cidr_block = cidrsubnet (
4926 data. aws_vpc . current . cidr_block ,
5027 var. newbits ,
51- var. netnum_offset + element (data . template_file . az_to_netnum [ * ] . rendered , count. index ) ,
28+ var. netnum_offset + count. index + 1 ,
5229 )
5330 map_public_ip_on_launch = var. public
5431 tags = var. tags
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ variable "netnum_offset" {
2121 description = " Offset the subnets netnum by a specific amount."
2222}
2323
24+ variable "blacklisted_names" {
25+ default = []
26+ description = " (Optional) List of blacklisted Availability Zone names."
27+ }
28+
2429variable "tags" {
2530 description = " (Optional) A mapping of tags to assign to the resources"
2631 type = map (string )
You can’t perform that action at this time.
0 commit comments