volcengine / terraform-provider-volcengine

Mozilla Public License 2.0
27 stars 10 forks source link

volcengine_rds_mysql_instance 某个 parameters 发生变化时,plan 只有该 parameters 的diff,但 apply 会重新更新所有 parameters #149

Closed cadl closed 11 months ago

cadl commented 11 months ago

配置demo如下:

resource "volcengine_rds_mysql_instance" "pkx_db_01" {
  db_engine_version = "MySQL_5_7"
  node_spec         = "rds.mysql.4c8g"
  primary_zone_id   = xxxx
  secondary_zone_id = xxx
  subnet_id         = xxx

  allow_list_ids = []
  db_time_zone           = "UTC +08:00"
  instance_name          = "xxx"
  lower_case_table_names = "0"
  storage_space          = 240

  charge_info {
    charge_type = "PrePaid"
    auto_renew  = true
    period_unit = "Month"
    period      = "1"
  }

  timeouts {
    create = "15m"
  }

  parameters {
    parameter_name  = "innodb_buffer_pool_size"
    # 4GB
    parameter_value = "4294967296"
  }

  parameters {
    parameter_name  = "innodb_io_capacity"
    parameter_value = "2000"
  }

  parameters {
    parameter_name  = "long_query_time"
    parameter_value = "0.2"
  }
}

假设本次修改只改了 parameters.long_query_time,terraform plan 也只会显示该 parameters 有变更,但是 apply 时在控制台发现本次提交了所有的 parameters 参数。如果其中包括需要重启的参数,会导致重启

.tf 代码变更:

diff --git a/ve-terraform/rds_pkx.tf b/ve-terraform/rds_pkx.tf
index 7a76cbcb5..6ff4d49e1 100644
--- a/ve-terraform/rds_pkx.tf
+++ b/ve-terraform/rds_pkx.tf
@@ -143,7 +143,7 @@ resource "volcengine_rds_mysql_instance" "pkx_db_01" {

   parameters {
     parameter_name  = "long_query_time"
-    parameter_value = "0.1"
+    parameter_value = "0.2"
   }

plan 显示 image

控制台显示所有tf 中涉及的参数全部发生了更新,虽然新旧值没有改变

img_v3_025t_07b00232-42bf-4f0f-8bf4-95d5b873e84g

预期只更新 terraform plan 中显示的修改,而不是默默提交所有参数

zpp12354321 commented 11 months ago

@cadl 您好,请问您的版本是多少呢

cadl commented 11 months ago

@cadl 您好,请问您的版本是多少呢

版本是 0.0.121

zpp12354321 commented 11 months ago

@cadl 您好,请问您的版本是多少呢

版本是 0.0.121

您好,感谢您的反馈,这块应该是一个 Bug,我们修复一下这个问题

zpp12354321 commented 11 months ago

@cadl 您好,麻烦升级到 0.0.130 版本再试一下呢?

Fix: https://github.com/volcengine/terraform-provider-volcengine/pull/150

cadl commented 11 months ago

@cadl 您好,麻烦升级到 0.0.130 版本再试一下呢?

Fix: #150

升级到 0.0.130 测试生效了,谢谢~