thousandeyes / terraform-provider-thousandeyes

ThousandEyes Terraform Provider
Apache License 2.0
21 stars 27 forks source link

two alerts for one tests state is not persisting #111

Closed Sraza11 closed 10 months ago

Sraza11 commented 2 years ago

I have two alerts attached to a test. Even after the "terraform apply" if I run terraform plan it shows pending change. @tduzan-te @sfreitas-te @pedro-te

# thousandeyes_agent_to_server.XXXXXX will be updated in-place
  ~ resource "thousandeyes_agent_to_server" "XXXXX" {
        id                     = "XXXXX"
      ~ path_trace_mode        = "classic" -> "inSession"
        # (24 unchanged attributes hidden)

      + alert_rules {
          + rule_id = 448261
        }

        # (6 unchanged blocks hidden)
    }

Plan: 0 to add, 14 to change, 0 to destroy.
pedro-te commented 2 years ago

Hi @Sraza11 ,

Thanks for reporting this. May I ask you to share a snippet of your terraform code that leads to this? Additionally is the plan showing changes to path_trace_mode and alert_rules on every run? Are those the pending changes that you're referring to? Please try to add as many details as possible so that we may attempt to reproduce the issue and resolve it.

Thanks, Pedro

Sraza11 commented 2 years ago

the following snippet of terraform code that is triggering this behavior. if I remove the second alert rule (rule_id=448261) the issue goes away.

alert_rules {
    rule_id = 448261
  }

this plan is not showing changes to path_tracemode but just the Alert rule_. here is what it offers the difference it will apply with terraform apply.

~ resource "thousandeyes_agent_to_server" "subnet-136-1" {
        id                     = "3168076"
        # (25 unchanged attributes hidden)

      + alert_rules {
          + rule_id = 448261
        }

        # (6 unchanged blocks hidden)
    }
pedro-te commented 2 years ago

@Sraza11 can you share the full resource with us, please? I want to try to reproduce the issue.

Sraza11 commented 2 years ago

Here is the complete resource

resource "thousandeyes_agent_to_server" "Akamai-subnet-161-215-209" {
  test_name              = "PUBLIC Prefix 161.215.209.0/24_TF"
  description            = "Description"
  interval               = 600
  alerts_enabled         = true
  enabled                = true
  server                 = "161.215.209.19"
  protocol               = "TCP"
  port                   = "443"
  path_trace_mode        = "inSession"
  bgp_measurements       = true
  use_public_bgp         = true
  bandwidth_measurements = false

  groups {
    group_id = var.Prolexic_TAG
  }
  groups {
    group_id = var.tfTAG
  }
  agents {
    agent_id = 92379 #Alibaba Agent
  }
  agents {
    agent_id = 55869 #Chicago agent
  }
  agents {
    agent_id = 7056 # Houston agent
  }
  alert_rules {
    rule_id = var.ProlexicRule
  }
  alert_rules {
    rule_id = var.BgpAlertRule
  }

}

variable "ProlexicRule" {
  description = "Prolexic Alert rule"
  type        = number
  default     = "1240429"
}

variable "BgpAlertRule" {
  description = "Bgp alert rule"
  type        = number
  default     = "448261"
}

variable "tfTAG" {
  description = "tf tag"
  type        = number
  default     = "421071"

}

variable "Prolexic_TAG" {
  description = "Prolexic Tag"
  type        = number
  default     = 88494
}
joaomper-TE commented 11 months ago

@Sraza11 while debugging this I found out that this only happens if one of the Alert Rules is a "default" one. Still not sure why, but just letting you know in case you need unblocking for this.

image