alicloud_dbfs_instance_attachment

更新时间:2025-04-02 00:59:25

Provides a Database File System (DBFS) Instance Attachment resource.

For information about Database File System (DBFS) Instance Attachment and how to use it, see What is Snapshot.

-> NOTE: Available since v1.156.0.

Example Usage

Basic Usage


variable "name" {
  default = "terraform-example"
}

provider "alicloud" {
  region = "cn-hangzhou"
}

locals {
  zone_id = "cn-hangzhou-i"
}

data "alicloud_dbfs_instances" "default" {
}

data "alicloud_instance_types" "default" {
  availability_zone    = local.zone_id
  instance_type_family = "ecs.g7se"
}

data "alicloud_images" "default" {
  instance_type = data.alicloud_instance_types.default.instance_types.0.id
  name_regex    = "^aliyun_2_19"
  owners        = "system"
}

data "alicloud_vpcs" "default" {
  name_regex = "^default-NODELETING$"
}

data "alicloud_vswitches" "default" {
  vpc_id  = data.alicloud_vpcs.default.ids.0
  zone_id = local.zone_id
}

resource "alicloud_security_group" "default" {
  name   = var.name
  vpc_id = data.alicloud_vpcs.default.ids.0
}

resource "alicloud_instance" "default" {
  image_id                   = data.alicloud_images.default.images.0.id
  instance_type              = data.alicloud_instance_types.default.instance_types.0.id
  security_groups            = alicloud_security_group.default.*.id
  internet_charge_type       = "PayByTraffic"
  internet_max_bandwidth_out = "10"
  availability_zone          = data.alicloud_instance_types.default.instance_types.0.availability_zones.0
  instance_charge_type       = "PostPaid"
  system_disk_category       = "cloud_essd"
  vswitch_id                 = data.alicloud_vswitches.default.ids.0
  instance_name              = var.name
}

resource "alicloud_dbfs_instance_attachment" "default" {
  instance_id = data.alicloud_dbfs_instances.default.instances.0.id
  ecs_id      = alicloud_instance.default.id
}

Argument Reference

The following arguments are supported:

  • instance_id - (Required, ForceNew) The ID of the Database File System.
  • ecs_id - (Required, ForceNew) The ID of the ECS instance.

Attributes Reference

The following attributes are exported:

  • id - The resource ID in terraform of Instance Attachment. It formats as <instance_id>:<ecs_id>.
  • status -The status of Instance Attachment.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 5 mins) Used when create the Instance Attachment .
  • delete - (Defaults to 5 mins) Used when delete the Instance Attachment .

Import

Database File System (DBFS) Instance Attachment can be imported using the id, e.g.

$ terraform import alicloud_dbfs_instance_attachment.example <instance_id>:<ecs_id>

  • 本页导读 (1)
  • Example Usage
  • Argument Reference
  • Attributes Reference
  • Timeouts
  • Import
AI助理

点击开启售前

在线咨询服务

你好,我是AI助理

可以解答问题、推荐解决方案等