Skip to content

Fix/allow remote sg #33

Merged
merged 3 commits into from
Nov 20, 2025
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,9 @@

* 2.8.1 -- 2025-10-02
- https: add module

* 2.9.0 -- 2025-11-20
- custom
- change the data resources for ingress and egress SG list to not try to look them up to get names if they
include a /, like for ACCOUNT/SGID for a referenced SG
- use the actual passed value in the name if it is a referenced SG
2 changes: 1 addition & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locals {
_module_version = "2.8.1"
_module_version = "2.9.0"
}
6 changes: 4 additions & 2 deletions custom/custom.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
locals {
vpc_networks = var.use_vpc_cidr ? [data.aws_vpc.this_vpc[0].cidr_block] : []
external_ingress_networks = compact(concat(local.vpc_networks, local.ingress_networks))
ingress_sg_names = zipmap(var.ingress_security_groups, data.aws_security_group.ingress_security_groups[*].name)
egress_sg_names = zipmap(var.egress_security_groups, data.aws_security_group.egress_security_groups[*].name)
# ingress_sg_names = zipmap(var.ingress_security_groups, data.aws_security_group.ingress_security_groups[*].name)
# egress_sg_names = zipmap(var.egress_security_groups, data.aws_security_group.egress_security_groups[*].name)
ingress_sg_names = { for sg in var.ingress_security_groups : sg => lookup(data.aws_security_group.ingress_security_groups, sg, { name = sg })["name"] }
egress_sg_names = { for sg in var.egress_security_groups : sg => lookup(data.aws_security_group.egress_security_groups, sg, { name = sg })["name"] }
# self = var.enable_self ? local.self_ports : []
}

Expand Down
1 change: 0 additions & 1 deletion custom/data.vpc.tf

This file was deleted.

18 changes: 18 additions & 0 deletions custom/data.vpc.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
data "aws_vpc" "this_vpc" {
count = var.use_vpc_cidr ? 1 : 0
id = var.vpc_id
}

data "aws_security_group" "ingress_security_groups" {
# count = length(var.ingress_security_groups)
# id = element(var.ingress_security_groups, count.index)
for_each = toset([for sg in var.ingress_security_groups : sg if !strcontains(sg, "/")])
id = each.key
}

data "aws_security_group" "egress_security_groups" {
# count = length(var.egress_security_groups)
# id = element(var.egress_security_groups, count.index)
for_each = toset([for sg in var.egress_security_groups : sg if !strcontains(sg, "/")])
id = each.key
}