cisco-open / terraform-provider-meraki

A Terraform Provider for Cisco Meraki
Mozilla Public License 2.0
15 stars 6 forks source link

resource `meraki_networks_alerts_settings` causes a panic on create when `muting` is set #71

Closed zbuchheit closed 2 months ago

zbuchheit commented 3 months ago

Prerequisites

Describe the bug When attempting to create meraki_networks_alerts_settings with muting.byPortSchedules.enabled set it causes a panic. Worth noting, if you create the resource without muting set and then add it to the code to update the resource it then succeeds.

Expected behavior I would expect the code not to panic and create the resource successfully.

Screenshots Please provide an screenshot of the successful API call with cuRL, Postman, etc.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

obrigg commented 2 months ago

Hi Zach, Can you kindly share the versions you're using, the TF file, and enable debugging (by setting TF_LOG=DEBUG, and adding

provider "meraki" {
  meraki_debug = "true"
}

to the TF file. This will help us identify the issue you're experiencing.

zbuchheit commented 2 months ago

this is my TF file

terraform {
  required_providers {
    meraki = {
      source = "cisco-open/meraki"
      version = "0.2.3-alpha"
    }
  }
}

provider "meraki" {
  meraki_debug = "true"
}

resource "meraki_networks_alerts_settings" "example" {
  network_id = "REDACTED"
  alerts = [{
    alert_destinations = {
      emails = ["test_email@meraki.com"]
      snmp = false
      all_admins = false
    }
    type = "ampMalwareDetected"
    enabled = true
  }]
  default_destinations = {
    all_admins = true
    emails = []
    snmp = false
  }
  muting = {
    by_port_schedules = {
      enabled = false
    }
  }
}

When I attempt to run terraform apply with the deub logs set it appears to point at provider.ResponseNetworksGetNetworkAlertsSettingsItemToBodyRs https://github.com/cisco-open/terraform-provider-meraki/blob/8e7518c39aeab69f5e702fe4474e1a57b07476c0/internal/provider/resource_meraki_networks_alerts_settings.go#L761 https://github.com/cisco-open/terraform-provider-meraki/blob/8e7518c39aeab69f5e702fe4474e1a57b07476c0/internal/provider/resource_meraki_networks_alerts_settings.go#L402

fmunozmiranda commented 2 months ago

closed due inactivity. @zbuchheit if you still have this issue, please reopen it.