Skip to content

Commit

Permalink
fix(script): missing remote address group id reference in resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Lance52259 committed Oct 21, 2024
1 parent 8f628fc commit 0f6473e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,18 @@ resource "huaweicloud_networking_secgroup_rule" "this" {

security_group_id = huaweicloud_networking_secgroup.this[0].id

description = lookup(element(var.security_group_rules_configuration, count.index), "description")
direction = lookup(element(var.security_group_rules_configuration, count.index), "direction")
ethertype = lookup(element(var.security_group_rules_configuration, count.index), "ethertype")
protocol = lookup(element(var.security_group_rules_configuration, count.index), "protocol")
ports = lookup(element(var.security_group_rules_configuration, count.index), "ports")
remote_ip_prefix = lookup(element(var.security_group_rules_configuration, count.index), "remote_group_id") == null ? lookup(element(var.security_group_rules_configuration, count.index), "remote_ip_prefix") : null
remote_group_id = lookup(element(var.security_group_rules_configuration, count.index), "remote_group_id")
action = lookup(element(var.security_group_rules_configuration, count.index), "action")
priority = lookup(element(var.security_group_rules_configuration, count.index), "priority")
description = lookup(element(var.security_group_rules_configuration, count.index), "description")
direction = lookup(element(var.security_group_rules_configuration, count.index), "direction")
ethertype = lookup(element(var.security_group_rules_configuration, count.index), "ethertype")
protocol = lookup(element(var.security_group_rules_configuration, count.index), "protocol")
ports = lookup(element(var.security_group_rules_configuration, count.index), "ports")
remote_ip_prefix = lookup(element(var.security_group_rules_configuration, count.index), "remote_group_id") == null && lookup(element(var.security_group_rules_configuration, count.index),
"remote_address_group_id") == null ? lookup(element(var.security_group_rules_configuration, count.index), "remote_ip_prefix") : null
remote_group_id = lookup(element(var.security_group_rules_configuration, count.index), "remote_group_id")
remote_address_group_id = lookup(element(var.security_group_rules_configuration, count.index), "remote_group_id") != null ? null : lookup(element(var.security_group_rules_configuration, count.index),
"remote_address_group_id")
action = lookup(element(var.security_group_rules_configuration, count.index), "action")
priority = lookup(element(var.security_group_rules_configuration, count.index), "priority")
}

resource "huaweicloud_vpc_address_group" "this" {
Expand Down

0 comments on commit 0f6473e

Please sign in to comment.