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

arvancloud_vpc_subnet_server_attachment (Resource)

Manages the attachment of a server to a VPC subnet, providing private IP connectivity.

Example Usage

# Attach a server to a VPC subnet
resource "arvancloud_vpc_subnet_server_attachment" "example" {
subnet_id = arvancloud_vpc_subnet.example.id
server_id = arvancloud_iaas_server.example.id
}

# Output the private IP assigned to the server
output "server_private_ip" {
value = arvancloud_vpc_subnet_server_attachment.example.private_ip
}

# Output the port ID
output "server_port_id" {
value = arvancloud_vpc_subnet_server_attachment.example.port_id
}

Schema

Required

  • server_id (String) ID of the server to attach to the subnet. Changing this value forces a new resource to be created.
  • subnet_id (String) ID of the subnet to attach the server to. Changing this value forces a new resource to be created.

Read-Only

  • id (String) Unique identifier of the attachment (format: {subnet_id}/{server_id}).
  • port_id (String) Port ID created for the server attachment.
  • private_ip (String) Private IP address assigned to the server in this subnet.
  • vpc_id (String) ID of the VPC that the subnet belongs to.

Import

Import is supported using the following syntax:

# Import a server attachment using subnet_id/server_id format
terraform import arvancloud_vpc_subnet_server_attachment.example subnet-12345678/server-87654321