Skip to main content

dtcloud_security_group (Data Source)

Looks up one security group, by id or by name.

Use it to reference a group Terraform did not create. The name lookup spares a hand-copied id: security_groups on a machine's network interface takes ids.

Example Usage​

# By id.
data "dtcloud_security_group" "web" {
id = var.security_group_id
}

# Or by name -- the lookup fails rather than guessing if the name matches more
# than one group.
data "dtcloud_security_group" "app" {
name = "app-tier"
}

Schema​

Optional​

  • id (String) ID of the security group to look up. Give this or name.
  • name (String) Name of the security group to look up. Give this or id. Must match exactly one group.

Read-Only​

  • description (String) Description of the security group.
  • inbound_rule (List of Object) Inbound rules as the platform displays them. (see below for nested schema)
  • outbound_rule (List of Object) Outbound rules as the platform displays them. (see below for nested schema)

Nested Schema for inbound_rule​

Read-Only:

  • id (String)
  • port_range (String)
  • protocol (String)
  • source (String)

Nested Schema for outbound_rule​

Read-Only:

  • id (String)
  • port_range (String)
  • protocol (String)
  • source (String)

Behaviour worth knowing​

  • A name must match exactly one group. Names are not unique on the platform, so a name that matches several groups is an error rather than an arbitrary pick. Look the group up by id instead.
  • The rule blocks are a display, as on the resource: protocol is a display name, port_range is text, and source is a CIDR or another group's name. Their id is the second half of a dtcloud_security_group_rule import id.