پرش به مطلب اصلی

arvancloud_iaas_security_groups (Data Source)

Lists IaaS security groups, optionally filtered by region or availability zone.

Example Usage

terraform {
required_providers {
arvancloud = {
source = "ArvanCloud/arvancloud"
}
}
}

# List all security groups across all availability zones
data "arvancloud_iaas_security_groups" "all" {}

# List security groups in a specific region
data "arvancloud_iaas_security_groups" "central" {
region = "ir-central1"
}

# List security groups in a specific availability zone
data "arvancloud_iaas_security_groups" "zone_a" {
availability_zone = "ir-central1-a"
}

output "all_security_groups" {
value = data.arvancloud_iaas_security_groups.all.security_groups
}

output "central_security_groups" {
value = data.arvancloud_iaas_security_groups.central.security_groups
}

Schema

Optional

  • availability_zone (String) Filter security groups by availability zone code name (e.g. ir-central1-a). Cannot be combined with region.
  • region (String) Filter security groups by region code name (e.g. ir-central1). Cannot be combined with availability_zone.

Read-Only

  • id (String) Unique identifier for this data source.
  • security_groups (Attributes List) List of security groups matching the specified filters. (see below for nested schema)

Nested Schema for security_groups

Read-Only:

  • availability_zone (String) Availability zone where the security group is stored (e.g. ir-central1-a).
  • description (String) Description of the security group.
  • id (String) Unique identifier of the security group.
  • name (String) Name of the security group.
  • read_only (Boolean) Whether the security group is read-only (managed by the platform).
  • real_name (String) Internal name of the security group assigned by the API.
  • region (String) Region where the security group is stored (e.g. ir-central1).
  • rules (Attributes List) List of rules associated with the security group. (see below for nested schema)

Nested Schema for security_groups.rules

Read-Only:

  • description (String) Description of the rule.
  • direction (String) Direction of the rule (ingress or egress).
  • ether_type (String) Ether type of the rule (IPv4 or IPv6).
  • id (String) Unique identifier of the rule.
  • port_range_max (Number) Maximum port number in the rule range. Null means any port.
  • port_range_min (Number) Minimum port number in the rule range. Null means any port.
  • protocol (String) Protocol of the rule (e.g. tcp, udp, icmp, or empty for any).
  • remote_group_id (String) ID of the remote security group for the rule.
  • remote_ip_prefix (String) Remote IP prefix (CIDR notation) for the rule.
  • security_group_id (String) ID of the security group this rule belongs to.