Skip to content

frostmoln_instance_port_security_groups (Resource)

Manages the security groups on a SINGLE network port of a multi-NIC compute instance, leaving the instance's other ports untouched. Use this when an instance's ports need DIFFERENT security-group sets; for one set applied uniformly across every port, set security_groups on the frostmoln_instance resource instead (the two are mutually exclusive ways to manage the same ports).

Example Usage

terraform
# Manage the security groups on a SINGLE port of a multi-NIC instance, leaving
# the instance's other ports untouched. Use this only when an instance's ports
# need DIFFERENT security-group sets; for one set applied to every port, use the
# security_groups attribute on frostmoln_instance instead.

resource "frostmoln_instance_port_security_groups" "frontend_nic" {
  instance_id = frostmoln_instance.example.id
  port_id     = "b1e0f6c2-1234-4a5b-9c8d-abcdef012345" # Neutron port ID (see the instance's per-port SG breakdown)

  security_groups = [
    frostmoln_security_group.web.id,
    frostmoln_security_group.ssh.id,
  ]
}

Schema

Required

  • instance_id (String) The ID of the instance the port belongs to.
  • port_id (String) The Neutron port ID to set security groups on. Port IDs are shown in the instance's per-port security-group breakdown (GET .../security-groups).
  • security_groups (Set of String) The security-group IDs (Neutron UUIDs) to set on the port (replace semantics — any security group not listed is removed from the port). An empty set clears all security groups on the port, leaving it on the VPC default-drop (typically no inbound access).

Read-Only

  • id (String) Composite identifier ({instance_id}/{port_id}).

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

shell
# Import an instance port's security-group binding by {instance_id}/{port_id}.
terraform import frostmoln_instance_port_security_groups.frontend_nic "inst-abc123/b1e0f6c2-1234-4a5b-9c8d-abcdef012345"