Skip to content

Commit

Permalink
fix: update logic that was using deprecated lookup feature (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
terraform-ibm-modules-ops authored Dec 18, 2023
1 parent eed487e commit 8d58f15
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-07-25T10:57:54Z",
"generated_at": "2023-12-17T20:20:32Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -77,7 +77,7 @@
}
],
"results": {},
"version": "0.13.1+ibm.61.dss",
"version": "0.13.1+ibm.62.dss",
"word_list": {
"file": null,
"hash": null
Expand Down
2 changes: 1 addition & 1 deletion load_balancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "ibm_is_lb" "lb" {
for_each = local.load_balancer_map
name = "${var.prefix}-${each.value.name}-lb"
subnets = var.subnets[*].id
type = each.value.type
type = each.value.type #checkov:skip=CKV2_IBM_1:See https://github.com/bridgecrewio/checkov/issues/5824#
profile = each.value.profile
security_groups = each.value.security_group == null ? null : [ibm_is_security_group.security_group[each.value.security_group.name].id]
resource_group = var.resource_group_id
Expand Down
30 changes: 6 additions & 24 deletions security_group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,12 @@ resource "ibm_is_security_group_rule" "security_group_rules" {
# Conditianally add content if sg has icmp
content {
type = lookup(
lookup(
each.value,
"icmp"
),
each.value["icmp"],
"type",
null
)
code = lookup(
lookup(
each.value,
"icmp"
),
each.value["icmp"],
"code",
null
)
Expand Down Expand Up @@ -144,19 +138,13 @@ resource "ibm_is_security_group_rule" "security_group_rules" {
# Conditionally adds content if sg has tcp
content {
port_min = lookup(
lookup(
each.value,
"tcp"
),
each.value["tcp"],
"port_min",
null
)

port_max = lookup(
lookup(
each.value,
"tcp"
),
each.value["tcp"],
"port_max",
null
)
Expand Down Expand Up @@ -193,18 +181,12 @@ resource "ibm_is_security_group_rule" "security_group_rules" {
# Conditionally adds content if sg has udp
content {
port_min = lookup(
lookup(
each.value,
"udp"
),
each.value["udp"],
"port_min",
null
)
port_max = lookup(
lookup(
each.value,
"udp"
),
each.value["udp"],
"port_max",
null
)
Expand Down

0 comments on commit 8d58f15

Please sign in to comment.