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

arvancloud_iaas_security_group (Resource)

Manages an IaaS security group in a specific availability zone.

Example Usage

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

# Create a security group in a specific availability zone
resource "arvancloud_iaas_security_group" "example" {
name = "my-security-group"
description = "Allow inbound HTTP and HTTPS traffic"
availability_zone = "ir-central1-a"
}

# Output computed fields
output "security_group_id" {
value = arvancloud_iaas_security_group.example.id
}

output "security_group_region" {
value = arvancloud_iaas_security_group.example.region
}

output "security_group_real_name" {
value = arvancloud_iaas_security_group.example.real_name
}

output "security_group_rules" {
value = arvancloud_iaas_security_group.example.rules
}

Schema

Required

  • availability_zone (String) Availability zone where the security group will be created (e.g. ir-central1-a).
  • name (String) Name of the security group. Must be unique within the availability zone.

Optional

  • description (String) Description of the security group.

Read-Only

  • id (String) Unique identifier of the security group assigned by the API.
  • 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 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.

Import

Import is supported using the following syntax:

terraform import arvancloud_iaas_security_group.example ir-central1-a:4ada3d42-5923-4167-8fa5-862075735dcb