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

arvancloud_iaas_file_storage_attachment (Resource)

Manages the attachment of a file storage volume to a compute server instance. This resource grants a server instance access to a file storage volume with specified permissions (read-only or read-write). Multiple server instances can be attached to the same file storage volume by creating multiple attachment resources.

Example Usage

# Attach a file storage volume to a compute server with read-write access
resource "arvancloud_iaas_file_storage_attachment" "example" {
file_storage_id = arvancloud_iaas_file_storage.shared.id
server_id = arvancloud_iaas_server.web1.id
availability_zone = "ir-central1-a"
access_level = "rw" # or "ro" for read-only access
}

# Attach the same file storage to another server (read-only)
resource "arvancloud_iaas_file_storage_attachment" "readonly" {
file_storage_id = arvancloud_iaas_file_storage.shared.id
server_id = arvancloud_iaas_server.web2.id
availability_zone = "ir-central1-a"
access_level = "ro"
}

output "attachment_id" {
value = arvancloud_iaas_file_storage_attachment.example.id
}

output "access_right_id" {
value = arvancloud_iaas_file_storage_attachment.example.access_right_id
}

output "server_private_ip" {
value = arvancloud_iaas_file_storage_attachment.example.private_ip
}

output "server_name" {
value = arvancloud_iaas_file_storage_attachment.example.server_name
}

Schema

Required

  • access_level (String) Access level for the attachment. Valid values: ro (read-only) or rw (read-write).
  • availability_zone (String) Availability zone where the file storage and server instance reside (e.g., ir-central1-a).
  • file_storage_id (String) ID of the file storage volume to attach.
  • server_id (String) ID of the compute server instance to attach the file storage to.

Read-Only

  • access_right_id (String) Access right ID assigned by the API. Used internally for detachment operations.
  • id (String) Unique identifier for this attachment (format: {file_storage_id}:{server_id}).
  • private_ip (String) Private IP address of the attached server instance.
  • server_name (String) Name of the attached server instance.

Import

Import is supported using the following syntax:

terraform import arvancloud_iaas_file_storage_attachment.example "ir-thr-si1:7b3e8c2f-4a6d-4e5c-9a1b-2d8f9e4a7c6b:ab5f9ae1-5c5e-44e2-8923-b11ea5a6e9c2"