diff --git a/volcengine/ecs/ecs_instance/common_volcengine_ecs_instance.go b/volcengine/ecs/ecs_instance/common_volcengine_ecs_instance.go index e3a5248c..09a22824 100644 --- a/volcengine/ecs/ecs_instance/common_volcengine_ecs_instance.go +++ b/volcengine/ecs/ecs_instance/common_volcengine_ecs_instance.go @@ -36,7 +36,7 @@ func EcsInstanceImportDiffSuppress(k, old, new string, d *schema.ResourceData) b return true } - if d.Get("instance_charge_type").(string) == "PostPaid" && (k == "period" || k == "period_unit" || k == "auto_renew" || k == "auto_renew_period") { + if d.Get("instance_charge_type").(string) == "PostPaid" && (k == "period" || k == "period_unit") { return true } diff --git a/volcengine/ecs/ecs_instance/service_volcengine_ecs_instance.go b/volcengine/ecs/ecs_instance/service_volcengine_ecs_instance.go index 185b69a2..c29b03dc 100644 --- a/volcengine/ecs/ecs_instance/service_volcengine_ecs_instance.go +++ b/volcengine/ecs/ecs_instance/service_volcengine_ecs_instance.go @@ -497,6 +497,12 @@ func (s *VolcengineEcsService) CreateResource(resourceData *schema.ResourceData, (*call.SdkParam)["Volumes.1.DeleteWithInstance"] = true (*call.SdkParam)["Count"] = 1 + if (*call.SdkParam)["InstanceChargeType"] != "PrePaid" { + delete(*call.SdkParam, "AutoRenew") + delete(*call.SdkParam, "AutoRenewPeriod") + delete(*call.SdkParam, "Period") + } + if _, ok := (*call.SdkParam)["ZoneId"]; !ok || (*call.SdkParam)["ZoneId"] == "" { var ( vnet map[string]interface{}