CiscoDevNet / terraform-provider-sdwan

Terraform Cisco SD-WAN Provider
https://registry.terraform.io/providers/CiscoDevNet/sdwan
Mozilla Public License 2.0
19 stars 11 forks source link

sdwan_sla_class_policy_object, fallback_best_tunnel_* items can be 0 #315

Open cmohorea opened 2 weeks ago

cmohorea commented 2 weeks ago

It could be more of vManage problem but still: "fallback_best_tunnel_jitter", "fallback_best_tunnel_latency", "fallback_best_tunnel_loss" parameters may be skipped during config.

image

When they are unused, in terraform they show up as 0 (unlike main parameters (loss, jitter, latency) which show up as null) which probably make sense in this case, since variance of 0 actually means that no variance in play. However, 0 is not accepted in the terraform configuration (allowed range starts at 1), so they cannot be configured as "0"

Error: Invalid Attribute Value

  with sdwan_sla_class_policy_object.test_CN_SLA_DEFAULT,
  on sdwan-tf-import-main.tf line 15365, in resource "sdwan_sla_class_policy_object" "test_CN_SLA_DEFAULT":
15365:   fallback_best_tunnel_jitter = 0

Attribute fallback_best_tunnel_jitter value must be between 1 and 1000, got:
0

They can be set as "null" with terraform (but I am not sure what the actual vManage config would be, it could actually require 0 there) but after editing in GUI, they will be set to 0 and terraform would try to fix it on the next run:

Terraform will perform the following actions:

  # sdwan_sla_class_policy_object.test_CN_SLA_DEFAULT will be updated in-place
  ~ resource "sdwan_sla_class_policy_object" "test_CN_SLA_DEFAULT" {
      - fallback_best_tunnel_jitter   = 0 -> null
      - fallback_best_tunnel_loss     = 0 -> null

I believe that it should be allowed to be 0, and documented that 0 means it's not in use.

cmohorea commented 2 weeks ago
resource "sdwan_sla_class_policy_object" "test_CN_SLA_DEFAULT" {
  name = "test_CN_SLA_DEFAULT"
  fallback_best_tunnel_criteria = "loss-latency"
  fallback_best_tunnel_latency = 10
#  fallback_best_tunnel_jitter = null
#  fallback_best_tunnel_loss = null
  latency = 200
  loss = 10
}

config for the reference