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

arvancloud_iaas_network_attachment (Resource)

Manages the attachment of a network to a compute server instance. This resource attaches an existing network to a server, optionally assigning a specific IP address and enabling port security.

Example Usage

resource "arvancloud_iaas_network" "private" {
name = "private-network"
availability_zone = "ir-central1-a"
# other fields are removed intentionally to reduce the doc size.
# refre to arvancloud_iaas_network doc and examples for more details on network resource configuration.
}

resource "arvancloud_iaas_server" "app" {
name = "app-server"
flavor = "g1-2-2"
image = "ubuntu-22.04"
availability_zone = "ir-central1-a"

# other fields are removed intentionally to reduce the doc size.
# refre to arvancloud_iaas_server doc and examples for more details on server resource configuration.
}

resource "arvancloud_iaas_network_attachment" "app_private" {
network_id = arvancloud_iaas_network.private.id
server_id = arvancloud_iaas_server.app.id
subnet_id = arvancloud_iaas_network.private.subnet_id
ip_address = "10.0.1.100"
enable_port_security = true
availability_zone = "ir-central1-a"
}

Schema

Required

  • availability_zone (String) Availability zone where the server and network reside (e.g., ir-central1-a).
  • enable_port_security (Boolean) Whether to enable port security on the attached network port.
  • network_id (String) ID of the network to attach.
  • server_id (String) ID of the compute server instance to attach the network to.
  • subnet_id (String) ID of the subnet within the network.

Optional

  • ip_address (String) Optional fixed IP address to assign to the server on this network. Note that this ip should be in range of the private network CIDR

Read-Only

  • id (String) Unique identifier for this attachment.
  • port_id (String) ID of the network port created for this attachment.

Import

Import is supported using the following syntax:

terraform import arvancloud_iaas_network_attachment.example "ir-thr-si1:ab5f9ae1-5c5e-44e2-8923-b11ea5a6e9c2:8f9e7a6b-5c4d-3e2f-1a0b-9c8d7e6f5a4b"