Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ resource "openstack_networking_port_v2" "control" {
subnet_id = data.openstack_networking_subnet_v2.cluster_subnet[each.key].id
}

port_security_enabled = lookup(each.value, "port_security_enabled", true)
security_group_ids = lookup(each.value, "port_security_enabled", true) ? [for o in data.openstack_networking_secgroup_v2.nonlogin: o.id] : []
port_security_enabled = lookup(each.value, "port_security_enabled", null)
security_group_ids = lookup(each.value, "port_security_enabled", null) != false ? [for o in data.openstack_networking_secgroup_v2.nonlogin: o.id] : []

binding {
vnic_type = lookup(var.vnic_types, each.key, "normal")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ resource "openstack_networking_port_v2" "compute" {
subnet_id = data.openstack_networking_subnet_v2.subnet[each.value.network].id
}

port_security_enabled = lookup(each.value, "port_security_enabled", true)
security_group_ids = lookup(each.value, "port_security_enabled", true) ? var.security_group_ids : []
port_security_enabled = lookup(each.value, "port_security_enabled", null)
security_group_ids = lookup(each.value, "port_security_enabled", null) != false ? var.security_group_ids : []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this wasn't just:

security_group_ids = lookup(each.value, "port_security_enabled", true) ? var.security_group_ids : []

what am I missing here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agh you're right I think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit isn't working for me, it still applies the security groups even when port_security_enabled is false. Can you please switch to @sjpb's suggestion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


binding {
vnic_type = lookup(var.vnic_types, each.value.network, "normal")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ variable "cluster_networks" {
List of mappings defining networks. Mapping key/values:
network: Required. Name of existing network
subnet: Required. Name of existing subnet
port_security_enabled: Optional. Bool, default true
port_security_enabled: Optional. Bool, default null (for networks not owned by project)
EOT
}

Expand Down