FlexibleEngineCloud / terraform-provider-flexibleengine

Terraform flexibleengine provider
https://www.terraform.io/docs/providers/flexibleengine/
Mozilla Public License 2.0
30 stars 53 forks source link

Prevent flexibleengine_networking_secgroup_rule_v2 replacement when update the description #782

Open mydoomfr opened 2 years ago

mydoomfr commented 2 years ago

Terraform Version

Terraform v1.2.5
on darwin_arm64
+ provider registry.terraform.io/flexibleenginecloud/flexibleengine v1.31.0

Affected Resource(s)

Expected Behavior

description field should only update itself and not replace the entire resource.

Actual Behavior

description field replaces the resource. (destroy/create)

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

resource "flexibleengine_networking_secgroup_v2" "secgroup_1" {
  name                           = "secgroup_1"
  description                 = "Managed by Terraform"
  delete_default_rules = true}

resource "flexibleengine_networking_secgroup_rule_v2" "secgroup_rule_1" {
  direction         = "ingress"
  ethertype         = "IPv4"
  protocol          = "tcp"
  port_range_min    = 22
  port_range_max    = 22
  remote_ip_prefix  = "0.0.0.0/0"
  security_group_id = flexibleengine_networking_secgroup_v2.secgroup_1.id
}
  1. Terraform Apply the above configuration.

  2. Add/Update a description on flexibleengine_networking_secgroup_rule_v2 resource

resource "flexibleengine_networking_secgroup_rule_v2" "secgroup_rule_1" {
  description.   = "Im going to replace the entire resource"
  direction         = "ingress"
  ethertype         = "IPv4"
  protocol          = "tcp"
  port_range_min    = 22
  port_range_max    = 22
  remote_ip_prefix  = "0.0.0.0/0"
  security_group_id = flexibleengine_networking_secgroup_v2.secgroup_1.id
}
  1. The resource will be replaced.

Debug Output

  # module.example.flexibleengine_networking_secgroup_rule_v2.secgroup_rule_1 must be replaced
-/+ resource "flexibleengine_networking_secgroup_rule_v2" "secgroup_rule_1" {
      + description       = "Im going to replace the entire resource" # forces replacement
      ~ id                = "a17e035d-11fe-42ab-b8e4-e430f796b545" -> (known after apply)
      ~ region            = "eu-west-0" -> (known after apply)
      + remote_group_id   = (known after apply)
      + tenant_id         = (known after apply)
        # (7 unchanged attributes hidden)
    }

References

Related to :

ShiChangkuo commented 2 years ago

@mydoomfr it seems that we have no such API to update the rule.