ucloud/terraform-provider-ucloud

ucloud_lb imported properties not matched with default values

ushuz opened this issue · 4 comments

ushuz commented

I imported an existing ULB into terraform for evaluation, here's my config for it:

resource "ucloud_lb" "ulb-01" {
  name          = "ulb-01"
  tag           = "ulb"
}

Because imported charge_type and internal are empty "", while their default values are "month" and false, terraform will always recreate the resource, which is not desired:

Terraform will perform the following actions:

-/+ ucloud_lb.ulb-01 (new resource required)
      id:          "ulb-abcdef" => <computed> (forces new resource)
      charge_type: "" => "month" (forces new resource)
      create_time: "2016-11-18T14:05:01+08:00" => <computed>
      expire_time: "1970-01-01T08:00:00+08:00" => <computed>
      internal:    "" => "false" (forces new resource)
      ip_set.#:    "1" => <computed>
      name:        "ulb-01" => "ulb-01"
      private_ip:  "" => <computed>
      remark:      "" => <computed>
      subnet_id:   "" => <computed>
      tag:         "ulb" => "ulb"
      vpc_id:      "uvnet-v5qggb" => <computed>

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

As a work around, I have to modify corresponding attributes field in terraform.tfstate and set:

"charge_type": "month",
"internal": "false",

We will fix this issue in the recent two days. If we finished, we will inform you as soon as possible!

We have fixed this issue in the last release, please update the ucloud provider and try again. You can see the details in CHANGELOG.

ushuz commented

@shawnmssu Fix confirmed, thanks for your quick response.