terraform-provider-huaweicloud icon indicating copy to clipboard operation
terraform-provider-huaweicloud copied to clipboard

[CBR] Incorrect work of auto_expand

Open ev-grebenyuk opened this issue 2 years ago • 1 comments

Terraform Version

$ terraform -v
Terraform v1.0.0
on darwin_amd64
+ provider registry.terraform.io/huaweicloud/huaweicloud v1.35.1

Your version of Terraform is out of date! The latest version
is 1.1.9. You can update by downloading from https://www.terraform.io/downloads.html

Terraform Configuration Files

resource "huaweicloud_compute_instance" "it03-server" {
  count             = 2
  name              = "it03-server${format("%02d", count.index + 1)}"
  image_id          = data.huaweicloud_images_image.sys_img_ipv6.id
  flavor_name       = "s6.medium.2"
  availability_zone = local.az1
  security_groups = [
    "default"
  ]
  system_disk_type = "SAS"
  system_disk_size = 40
  network {
    uuid = module.sandbox_vpc.subnets.it03.id
  }
}

resource "huaweicloud_cbr_vault" "auto_expand_issue" {
  name             = "auto_expand_issue"
  type             = "server"
  size             = 20
  auto_expand      = true
  consistent_level = "crash_consistent"
  protection_type  = "backup"
  policy_id        = resource.huaweicloud_cbr_policy.test-policy.id
  resources {
    server_id = resource.huaweicloud_compute_instance.it03-server[0].id
  }
}


Debug Output

Crash Output

Expected Behavior

Do not reduce the vault size if it was previously increased via auto expansion.

Actual Behavior

size and auto_expand - are concurrent arguments. The vault size is reduced if it was previously increased using automatic expansion.

Steps to Reproduce

  1. Create vault with attached policy and associated server (I have an ECS with about 25G data on it, vault size is 20G)
  2. Wait for an auto expansion of the vault during a regular backup task. The size of the vault will be increased (I.e. in my case vault size was automatically increased from 20G to 31G)
  3. Make terraform plan. It will show now that the vault size will be reduced according to my terraform code:
Terraform will perform the following actions:

  # huaweicloud_cbr_vault.auto_expand_issue will be updated in-place
  ~ resource "huaweicloud_cbr_vault" "auto_expand_issue" {
        id                    = "479915d0-9375-4609-9038-bef625823cee"
        name                  = "auto_expand_issue"
      ~ size                  = 31 -> 20
        tags                  = {}
        # (10 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Additional Context

References

ev-grebenyuk avatar May 18 '22 12:05 ev-grebenyuk

@ev-grebenyuk sorry for the delay. You can ignore the change as follows:

resource "huaweicloud_cbr_vault" "test" {
    ...

  lifecycle {
    ignore_changes = [ size ]
  }
}

ShiChangkuo avatar Jul 18 '22 07:07 ShiChangkuo

@ev-grebenyuk I will close it temporarily, If you have any questions, please reopen it. Thanks.

ShiChangkuo avatar Mar 06 '23 09:03 ShiChangkuo