-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: additional functionality added along with fix of double ACL for…
… rule names (#33) BREAKING CHANGE: `vpc_name` variable is now called `name`
- Loading branch information
Showing
13 changed files
with
119 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
############################################################################## | ||
# Address Prefixes | ||
############################################################################## | ||
|
||
module "prefix_map" { | ||
source = "./config_modules/list_to_map" | ||
key_name_field = "zone_name" | ||
list = [ | ||
for zone in ["zone-1", "zone-2", "zone-3"] : | ||
{ | ||
zone_name = zone | ||
addresses = [ | ||
for address in(lookup(var.address_prefixes, zone, null) == null ? [] : var.address_prefixes[zone]) : | ||
{ | ||
name = "${var.prefix}-${zone}-${index(var.address_prefixes[zone], address) + 1}" | ||
cidr = address | ||
zone = "${var.region}-${index(keys(var.address_prefixes), zone) + 1}" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
||
module "address_prefixes" { | ||
source = "./config_modules/list_to_map" | ||
list = flatten([ | ||
for zone in ["zone-1", "zone-2", "zone-3"] : | ||
module.prefix_map.value[zone].addresses | ||
]) | ||
} | ||
|
||
############################################################################## |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
############################################################################## | ||
# Output | ||
############################################################################## | ||
|
||
output "value" { | ||
description = "List converted into map" | ||
value = { | ||
for item in var.list : | ||
("${var.prefix == "" ? "" : "${var.prefix}-"}${item[var.key_name_field]}") => | ||
item if( | ||
var.lookup_field == null # If not looking up | ||
? true # true | ||
: can(regex(var.lookup_value_regex, tostring(lookup(item, var.lookup_field, null)))) # Otherwise match regex | ||
) | ||
} | ||
} | ||
|
||
############################################################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
############################################################################## | ||
# Variables | ||
############################################################################## | ||
|
||
variable "list" { | ||
description = "List of objects" | ||
type = list(any) | ||
} | ||
|
||
variable "prefix" { | ||
description = "Prefix to add to map keys" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "key_name_field" { | ||
description = "Key inside each object to use as the map key" | ||
type = string | ||
default = "name" | ||
} | ||
|
||
variable "lookup_field" { | ||
description = "Name of the field to find with lookup" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "lookup_value_regex" { | ||
description = "regular expression for reurned value" | ||
type = string | ||
default = null | ||
} | ||
|
||
############################################################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
############################################################################## | ||
# Terraform Providers | ||
############################################################################## | ||
|
||
terraform { | ||
required_version = ">=1.0.0" | ||
experiments = [module_variable_optional_attrs] | ||
} | ||
|
||
############################################################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters