CiscoISE / terraform-provider-ciscoise

Terraform Provider for Cisco ISE
https://registry.terraform.io/providers/CiscoISE/ciscoise/latest/docs
MIT License
10 stars 4 forks source link

ciscoise_node_services_profiler_probe_config - Resource creation not working #15

Closed ragu2k8 closed 2 years ago

ragu2k8 commented 2 years ago

@wastorga when we run below resource, its not updated on server side(probes are not enabled) and its not showing any error on terraform either however direct api works without issues.

resource "ciscoise_node_services_profiler_probe_config" "configure_profiling_probe" {
  parameters {
    hostname           = "isenode1"
    active_directory   {
      days_before_rescan = 1
    }
    http  {
      interfaces  {
        interface  = "GigabitEthernet 0"
      }
    }
    dhcp  {
      interfaces  {
        interface  = "GigabitEthernet 0"
      }
      port = 67
    }
    radius = []
    nmap = []
    dns {
      timeout =  2
    }
    snmp_query {
      retries = 2
      timeout = 1000
      event_timeout = 30
    }
  }
}

log: Changes to Outputs:

  + ciscoise_node_services_profiler_probe_config_details = {
      + id           = (known after apply)
      + item         = (known after apply)
      + last_updated = (known after apply)
      + parameters   = [
          + {
              + active_directory = [
                  + {
                      + days_before_rescan = 1
                    },
                ]
              + dhcp             = [
                  + {
                      + interfaces = [
                          + {
                              + interface = "GigabitEthernet 0"
                            },
                        ]
                      + port       = 67
                    },
                ]
              + dhcp_span        = []
              + dns              = [
                  + {
                      + timeout = 2
                    },
                ]
              + hostname         = "isenode1"
              + http             = [
                  + {
                      + interfaces = [
                          + {
                              + interface = "GigabitEthernet 0"
                            },
                        ]
                    },
                ]
              + netflow          = []
              + nmap             = []
              + pxgrid           = null
              + radius           = []
              + snmp_query       = [
                  + {
                      + event_timeout = 30
                      + retries       = 2
                      + timeout       = 1000
                    },
                ]
              + snmp_trap        = []
            },
        ]
    }
ciscoise_node_services_profiler_probe_config.configure_profiling_probe: Creating...
ciscoise_node_services_profiler_probe_config.configure_profiling_probe: Creation complete after 0s [id=hostname:=isenode1]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
wastorga commented 2 years ago

It does not update it the first time. The first time only adds it in Terraform as a resource. Following changes to the resource.tf settings will call the update ISE.

ragu2k8 commented 2 years ago

@wastorga thanks for clarifying. however when i do changes for below probes, its not getting updated for probes where list is empty but whereas other probes works radius = [] nmap = [] above just need empty list right nothing required to pass its not being updated properly

so i tried manually enabling probe on server and run terraform file, it disables the probes if we send empty list.

In API :

radius = null -> disables it
radius = [] ->  enables it (passing empty list)

looks when it pull resources first time,it defaults all probes to empty list

and also getting below error:


ciscoise_node_services_profiler_probe_config.configure_profiling_probe: Modifying... [id=hostname:=isenode1]
╷
│ Error: Failure when executing SetProfilerProbeConfig
│ 
│   with ciscoise_node_services_profiler_probe_config.configure_profiling_probe,
│   on deployment.tf line 77, in resource "ciscoise_node_services_profiler_probe_config" "configure_profiling_probe":
│   77: resource "ciscoise_node_services_profiler_probe_config" "configure_profiling_probe" {
│ 
│ unexpected end of JSON input

resource:

resource "ciscoise_node_services_profiler_probe_config" "configure_profiling_probe" {

  parameters {
    hostname           = "isenode1"
    active_directory   {
      days_before_rescan = 1
    }
    http  {
      interfaces  {
        interface  = "GigabitEthernet 0"
      }
    }
    dhcp  {
      interfaces  {
        interface  = "GigabitEthernet 0"
      }
      port = 67
    }
    radius =[]
    dns {
      timeout =  3
    }
    snmp_query {
      retries = 2
      timeout = 1000
      event_timeout = 30
    }
    nmap = []
    pxgrid = []
  }
 }
wastorga commented 2 years ago

@ragu2k8 I lack the means of testing for the moment. However, I suspect it is related to the isEmptyValue function, which does not allow the empty array/slice to be added in the update context. I will look into it as soon as I can.

ragu2k8 commented 2 years ago

sure @wastorga let me know. I did bit more testing and i can add more details if you need.

ragu2k8 commented 2 years ago

@wastorga any luck?

wastorga commented 2 years ago

Some, @ragu2k8. The API's empty probes (i.e., without properties to set) behave more like boolean (true if it has an array, false if null). So, considering Terraform Default behavior, I am tempted to change them to a TypeString with enum values ["", true, false], where the empty string represents that it does not want any change. I'll get back to you tomorrow with an update.

ragu2k8 commented 2 years ago

sure @wastorga thanks for update

wastorga commented 2 years ago

@ragu2k8 I released the new version, v0.1.0-rc.3, a couple of minutes ago. The resource (node_services_profiler_probe_config) now performs the update at Tf (resource) creation. As discussed earlier, it also has new parameters' types for Nmap, pxGrid, and Radius.

ragu2k8 commented 2 years ago

@wastorga awesome..i have just tested it and it works fine. Thanks for support.