-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pull out prefix lists var and data to their own files
- Loading branch information
Showing
16 changed files
with
76 additions
and
105 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| data "aws_ec2_managed_prefix_list" "ingress" { | ||
| for_each = toset(var.ingress_prefix_list_names) | ||
| filter { | ||
| name = "prefix-list-name" | ||
| values = [each.key] | ||
| } | ||
| } | ||
|
|
||
| data "aws_ec2_managed_prefix_list" "egress" { | ||
| for_each = toset(var.egress_prefix_list_names) | ||
| filter { | ||
| name = "prefix-list-name" | ||
| values = [each.key] | ||
| } | ||
| } |
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,12 @@ | ||
| variable "ingress_prefix_list_names" { | ||
| description = "List of prefix list names for ingress access" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "egress_prefix_list_names" { | ||
| description = "List of prefix list names for eggress access" | ||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
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 was deleted.
Oops, something went wrong.
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 @@ | ||
| ../common/data.prefix_lists.tf |
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 @@ | ||
| ../common/variables.prefix_lists.tf |
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,33 @@ | ||
| * # ingress_prefix_list_names = [ "wifi-networks.core", "vpn-networks.core" ] | ||
| * # egress_prefix_list_names = [ ] | ||
| * | ||
| * ## ingress_prefix_list_names | ||
| * In order to use a managed prefix list, you may pass a list of names in this field. The prefix lists | ||
| * will be looked up and the resultant IDs used in the security group for inbound port access to Redshift. | ||
| * This will fail if the prefix list does not exist. | ||
|
|
||
| # ingress with prefix lists | ||
| dynamic "ingress" { | ||
| for_each = length(var.ingress_prefix_list_names) > 0 ? local.port_map["external"] : toset([]) | ||
| iterator = p | ||
| content { | ||
| description = "${local.short_description}: ${p.value["description"]}" | ||
| from_port = p.value["from"] | ||
| to_port = p.value["to"] | ||
| protocol = p.value["proto"] | ||
| prefix_list_ids = [for pl in data.aws_ec2_managed_prefix_list.ingress : pl.id] | ||
| } | ||
| } | ||
|
|
||
| # egress with prefix lists | ||
| dynamic "egress" { | ||
| for_each = length(var.egress_prefix_list_names) > 0 ? { 1 = 1 } : {} | ||
| iterator = p | ||
| content { | ||
| description = "${local.short_description}" | ||
| from_port = 0 | ||
| to_port = 0 | ||
| protocol = -1 | ||
| prefix_list_ids = [for pl in data.aws_ec2_managed_prefix_list.egress : pl.id] | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
| ../common/data.prefix_lists.tf |
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 @@ | ||
| ../common/variables.prefix_lists.tf |
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 was deleted.
Oops, something went wrong.
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 @@ | ||
| ../common/data.prefix_lists.tf |
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 @@ | ||
| ../common/variables.prefix_lists.tf |
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