From 611ff76c706ab16518972f5e89f045de11428589 Mon Sep 17 00:00:00 2001 From: "renzheng.wang" Date: Fri, 8 Mar 2024 12:21:55 +0800 Subject: [PATCH] add device_name attribute to ucloud_disk_attachment --- ucloud/resource_ucloud_disk_attachment.go | 6 ++++++ website/docs/r/disk_attachment.html.markdown | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ucloud/resource_ucloud_disk_attachment.go b/ucloud/resource_ucloud_disk_attachment.go index c7c39990..eb38c08b 100644 --- a/ucloud/resource_ucloud_disk_attachment.go +++ b/ucloud/resource_ucloud_disk_attachment.go @@ -43,6 +43,11 @@ func resourceUCloudDiskAttachment() *schema.Resource { Type: schema.TypeBool, Optional: true, }, + + "device_name": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -100,6 +105,7 @@ func resourceUCloudDiskAttachmentRead(d *schema.ResourceData, meta interface{}) d.Set("availability_zone", d.Get("availability_zone").(string)) d.Set("instance_id", resourceSet.UHostId) d.Set("disk_id", resourceSet.UDiskId) + d.Set("device_name", resourceSet.DeviceName) return nil } diff --git a/website/docs/r/disk_attachment.html.markdown b/website/docs/r/disk_attachment.html.markdown index 7e200a41..ab2be69c 100644 --- a/website/docs/r/disk_attachment.html.markdown +++ b/website/docs/r/disk_attachment.html.markdown @@ -59,4 +59,10 @@ The following arguments are supported: * `instance_id` - (Required, ForceNew) The ID of instance. * `disk_id` - (Required, ForceNew) The ID of disk that needs to be attached * `stop_instance_before_detaching` - (Optional, Boolean) Set this to true to ensure that the target instance is stopped - before trying to detach the volume. \ No newline at end of file + before trying to detach the volume. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `device_name` - The device name to expose to the instance, for example `vdb`. \ No newline at end of file