alicloud_hbr_ecs_backup_plan

Provides a HBR Ecs Backup Plan resource.

For information about HBR Ecs Backup Plan and how to use it, see What is Ecs Backup Plan.

Example Usage

Basic Usage

data "alicloud_zones" "example" {
  available_resource_creation = "Instance"
}

data "alicloud_instance_types" "example" {
  availability_zone = data.alicloud_zones.example.zones.0.id
  cpu_core_count    = 1
  memory_size       = 2
}

data "alicloud_images" "example" {
  name_regex = "^ubuntu_[0-9]+_[0-9]+_x64*"
  owners     = "system"
}

resource "alicloud_vpc" "example" {
  vpc_name   = "terraform-example"
  cidr_block = "172.17.3.0/24"
}

resource "alicloud_vswitch" "example" {
  vswitch_name = "terraform-example"
  cidr_block   = "172.17.3.0/24"
  vpc_id       = alicloud_vpc.example.id
  zone_id      = data.alicloud_zones.example.zones.0.id
}

resource "alicloud_security_group" "example" {
  name   = "terraform-example"
  vpc_id = alicloud_vpc.example.id
}

resource "alicloud_instance" "example" {
  image_id             = data.alicloud_images.example.images.0.id
  instance_type        = data.alicloud_instance_types.example.instance_types.0.id
  availability_zone    = data.alicloud_zones.example.zones.0.id
  security_groups      = [alicloud_security_group.example.id]
  instance_name        = "terraform-example"
  internet_charge_type = "PayByBandwidth"
  vswitch_id           = alicloud_vswitch.example.id
}

resource "alicloud_hbr_vault" "example" {
  vault_name = "terraform-example"
}

resource "alicloud_hbr_ecs_backup_plan" "example" {
  ecs_backup_plan_name = "terraform-example"
  instance_id          = alicloud_instance.example.id
  vault_id             = alicloud_hbr_vault.example.id
  retention            = "1"
  schedule             = "I|1602673264|PT2H"
  backup_type          = "COMPLETE"
  speed_limit          = "0:24:5120"
  path                 = ["/home", "/var"]
  exclude              = <<EOF
  ["/home/exclude"]
  EOF
  include              = <<EOF
  ["/home/include"]
  EOF
}
  ["/home/exclude"]
  EOF
  include              = <<EOF
  ["/home/include"]
  EOF
}
  ["/home/include"]
  EOF
}

Argument Reference

The following arguments are support:

Notice

About Backup path rules:

  1. If there is no wildcard *, you can enter 8 items of path.
  2. When using wildcard *, only one item of path can be input, and wildcards like /*/* are supported.
  3. Each item of path only supports absolute paths, for example starting with /, \, C:\, D:\.

About Restrictions:

  1. When using VSS: multiple paths, UNC paths, wildcards, and excluded files not supported.
  2. When using UNC: VSS not supported, wildcards not supported, and files to be excluded are not supported.

About include/exclude path rules:

  1. Supports up to 8 paths, including paths using wildcards *.
  2. If the path does not contain /, then * matches multiple path names or file names, for example *abc* will match /abc/, /d/eabcd/, /a/abc; *.txt will match all files with an extension .txt.
  3. If the path contains /, each * only matches a single-level path or file name. For example, /a/*/*/ share will match /a/b/c/share, but not /a/d/share.
  4. If the path ends with /, it means the folder matches. For example, *tmp/ will match /a/b/aaatmp/, /tmp/ and so on.
  5. The path separator takes Linux system / as an example, if it is Windows system, please replace it with \.

Attributes Reference

The following attributes are exported:

Import

HBR Ecs Backup Plan can be imported using the id, e.g.

$ terraform import alicloud_hbr_ecs_backup_plan.example <id>