alicloud_cloud_storage_gateway_express_sync

更新时间:

Provides a Cloud Storage Gateway Express Sync resource.

For information about Cloud Storage Gateway Express Sync and how to use it, see What is Express Sync.

-> NOTE: Available since v1.144.0.

Example Usage

Basic Usage


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

resource "random_integer" "default" {
  min = 10000
  max = 99999
}

data "alicloud_regions" "default" {
  current = true
}
resource "random_uuid" "default" {
}
resource "alicloud_cloud_storage_gateway_storage_bundle" "default" {
  storage_bundle_name = substr("tf-example-${replace(random_uuid.default.result, "-", "")}", 0, 16)
}

resource "alicloud_oss_bucket" "default" {
  bucket = substr("tf-example-${replace(random_uuid.default.result, "-", "")}", 0, 16)
}

resource "alicloud_oss_bucket_acl" "default" {
  bucket = alicloud_oss_bucket.default.bucket
  acl    = "public-read-write"
}

resource "alicloud_vpc" "default" {
  vpc_name   = var.name
  cidr_block = "172.16.0.0/12"
}
data "alicloud_cloud_storage_gateway_stocks" "default" {
  gateway_class = "Standard"
}
resource "alicloud_vswitch" "default" {
  vpc_id       = alicloud_vpc.default.id
  cidr_block   = "172.16.0.0/21"
  zone_id      = data.alicloud_cloud_storage_gateway_stocks.default.stocks.0.zone_id
  vswitch_name = var.name
}

resource "alicloud_cloud_storage_gateway_gateway" "default" {
  gateway_name             = var.name
  description              = var.name
  gateway_class            = "Standard"
  type                     = "File"
  payment_type             = "PayAsYouGo"
  vswitch_id               = alicloud_vswitch.default.id
  release_after_expiration = true
  public_network_bandwidth = 40
  storage_bundle_id        = alicloud_cloud_storage_gateway_storage_bundle.default.id
  location                 = "Cloud"
}

resource "alicloud_cloud_storage_gateway_gateway_cache_disk" "default" {
  cache_disk_category   = "cloud_efficiency"
  gateway_id            = alicloud_cloud_storage_gateway_gateway.default.id
  cache_disk_size_in_gb = 50
}

resource "alicloud_cloud_storage_gateway_gateway_file_share" "default" {
  gateway_file_share_name = var.name
  gateway_id              = alicloud_cloud_storage_gateway_gateway.default.id
  local_path              = alicloud_cloud_storage_gateway_gateway_cache_disk.default.local_file_path
  oss_bucket_name         = alicloud_oss_bucket.default.bucket
  oss_endpoint            = alicloud_oss_bucket.default.extranet_endpoint
  protocol                = "NFS"
  remote_sync             = true
  polling_interval        = 4500
  fe_limit                = 0
  backend_limit           = 0
  cache_mode              = "Cache"
  squash                  = "none"
  lag_period              = 5
}

resource "alicloud_cloud_storage_gateway_express_sync" "default" {
  bucket_name       = alicloud_cloud_storage_gateway_gateway_file_share.default.oss_bucket_name
  bucket_region     = data.alicloud_regions.default.regions.0.id
  description       = var.name
  express_sync_name = "${var.name}-${random_integer.default.result}"
}

Argument Reference

The following arguments are supported:

  • bucket_name - (Required, ForceNew) The name of the OSS Bucket.
  • bucket_prefix - (Optional, ForceNew) The prefix of the OSS Bucket.
  • bucket_region - (Required, ForceNew) The region of the OSS Bucket.
  • description - (Optional, ForceNew) The description of the Express Sync. The length of the name is limited to 1 to 255 characters.
  • express_sync_name - (Required, ForceNew) The name of the ExpressSync. The length of the name is limited to 1 to 128 characters. It can contain uppercase and lowercase letters, Chinese characters, numbers, English periods (.), underscores (_), or hyphens (-), and must start with letters.

Attributes Reference

The following attributes are exported:

  • id - The resource ID in terraform of ExpressSync. The value is formate as <express_sync_id>.

Timeouts

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

  • delete - (Defaults to 5 mins) Used when delete the Express Sync.

Import

Cloud Storage Gateway Express Sync can be imported using the id, e.g.

$ terraform import alicloud_cloud_storage_gateway_express_sync.example <id>