site24x7 / terraform-provider-site24x7

Terraform provider for Site24x7
MIT License
22 stars 33 forks source link

Terraform Plan Shows Spurious Removal of auth_user when Using credential_profile_id with Monitor #261

Open jamiejackson opened 3 months ago

jamiejackson commented 3 months ago

Provider version: 1.0.84

It seems that if you use credential_profile_id in site24x7_website_monitor, then plans always show that the auth_user will be removed. You can plan and apply over and over and the plan will still show this proposed change. It's as if the provider is mixed up about credential_profile_id vs auth_user/auth_pass.

This prevents me from automating Terraform drift detection.

locals {
  credential_type = {
    vmware_vcenter           = 1
    vmware_esx               = 2
    web_credentials          = 3
    vmware_vdi               = 4
    client_certificates      = 5
    ssh                      = 7
    nutanix_cluster          = 6
    lama_credentials         = 9
    veeam_enterprise_manager = 8
  }
  # the oauth access token doesn't seem to have permissions to do a credentials lookup
  credentials = {
    stage_basic_auth_id = "207348000012018001"
  }
  auth_method = {
    basic    = "B"
    oauth2   = "O"
    webtoken = "W"
  }
}

resource "site24x7_website_monitor" "home_page__stage" {
  display_name                = "Home Page"
  website                     = "https://example.com/"
  auth_method                 = local.auth_method.basic
  check_frequency             = "1"
  credential_profile_id       = local.credentials.stage_basic_auth_id
  ignore_cert_err             = false
  location_profile_id         = site24x7_location_profile.united_states.id
  match_regex_severity        = 2
  matching_keyword_severity   = 0
  matching_keyword_value      = "need housing assistance"
  timeout                     = 30
  unmatching_keyword_severity = 2
  use_name_server             = false
  monitor_groups = [
    site24x7_monitor_group.stage.id
  ]
  third_party_service_ids = ["207348000005128003"]
}

terraform plan always shows.

  # site24x7_website_monitor.home_page__stage will be updated in-place
  ~ resource "site24x7_website_monitor" "home_page__stage" {
      - auth_user                   = "REDACTED" -> null
        id                          = "207348000000114064"
        # (41 unchanged attributes hidden)
    }