aliyun / terraform-provider-alicloud

Terraform AliCloud provider
https://www.terraform.io/docs/providers/alicloud/
Mozilla Public License 2.0
590 stars 553 forks source link

alicloud_vpn_gateway perpetually recreates itself if vswitch_id is not set #1972

Open chanind opened 4 years ago

chanind commented 4 years ago

If you create a alicloud_vpn_gateway and don't set vswitch_id, then a random vswitch_id is assigned. Then on the next run, Terraform tries to set vswitch_id back to null, which causes the alicloud_vpn_gateway resource to be recreated. This then happens forever on every run.

The easiest solution would be to just mark vswitch_id as required instead of optional.

Terraform Version

Terraform: 0.12.17 Alicloud: 1.64.0

Affected Resource(s)

xiaozhu36 commented 4 years ago

HI @chanind Thanks for your suggestion. But I don't think that making it required is good idea because of it can not be sync with product. The PR #1977 has fixed it and if vswitch_id is not set, the default will be returned.