alicloud_dbfs_snapshot
更新时间:
Provides a DBFS Snapshot resource.
For information about DBFS Snapshot and how to use it.
-> NOTE: Available since v1.156.0.
Example Usage
Basic Usage
variable "name" {
default = "tf-example"
}
provider "alicloud" {
region = "cn-hangzhou"
}
locals {
zone_id = "cn-hangzhou-i"
}
data "alicloud_instance_types" "example" {
availability_zone = local.zone_id
instance_type_family = "ecs.g7se"
}
data "alicloud_images" "example" {
instance_type = data.alicloud_instance_types.example.instance_types[length(data.alicloud_instance_types.example.instance_types) - 1].id
name_regex = "^aliyun_2_1903_x64_20G_alibase_20240628.vhd"
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" "example" {
name = var.name
vpc_id = data.alicloud_vpcs.default.ids[0]
}
resource "alicloud_instance" "default" {
availability_zone = local.zone_id
instance_name = var.name
image_id = data.alicloud_images.example.images.0.id
instance_type = data.alicloud_instance_types.example.instance_types[length(data.alicloud_instance_types.example.instance_types) - 1].id
security_groups = [alicloud_security_group.example.id]
vswitch_id = data.alicloud_vswitches.default.ids.0
system_disk_category = "cloud_essd"
}
resource "alicloud_dbfs_instance" "default" {
category = "enterprise"
zone_id = alicloud_instance.default.availability_zone
performance_level = "PL1"
fs_name = var.name
size = 100
}
resource "alicloud_dbfs_instance_attachment" "default" {
ecs_id = alicloud_instance.default.id
instance_id = alicloud_dbfs_instance.default.id
}
resource "alicloud_dbfs_snapshot" "example" {
instance_id = alicloud_dbfs_instance_attachment.default.instance_id
snapshot_name = var.name
description = var.name
retention_days = 30
}
Argument Reference
The following arguments are supported:
description
- (Optional, ForceNew) Description of the snapshot. The description must be2
to256
characters in length. It must start with a letter, and cannot start withhttp://
orhttps://
.force
- (Optional) Whether to force deletion of snapshots.instance_id
- (Required, ForceNew) The ID of the database file system.retention_days
- (Optional, ForceNew) The retention time of the snapshot. Unit: days. Snapshots are automatically released after the retention time expires. Valid values:1
to65536
.snapshot_name
- (Optional, ForceNew) The display name of the snapshot. The length is2
to128
characters. It must start with a large or small letter or Chinese, and cannot start withhttp://
andhttps://
. It can contain numbers, colons (:), underscores (_), or hyphens (-). To prevent name conflicts with automatic snapshots, you cannot start withauto
.
Attributes Reference
The following attributes are exported:
id
- The resource ID in terraform of Snapshot.status
- The status of the Snapshot.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 5 mins) Used when create the Snapshot.delete
- (Defaults to 1 mins) Used when delete the Snapshot.
Import
DBFS Snapshot can be imported using the id, e.g.
$ terraform import alicloud_dbfs_snapshot.example <id>
文档内容是否对您有帮助?