cisco-open / terraform-provider-meraki

A Terraform Provider for Cisco Meraki
Mozilla Public License 2.0
16 stars 7 forks source link

meraki_networks_switch_stacks_routing_interfaces - additional values in the API request #97

Closed mcparaf closed 3 months ago

mcparaf commented 4 months ago

Prerequisites

Describe the bug When trying to edit a switch stack routing interface the provider supplies additional argument to the API request and then API says that the additionally provided argument was wrong. From my research it seems that the additional argument value is downloaded directly from the API and has nothing to do with the data I provided myself. In particular, I made sure not to include the argument in my resource:

resource "meraki_networks_switch_stacks_routing_interfaces" "net_switch_stacks_routing_interfaces" {
  for_each        = { for data in local.networks_switch_stacks_routing_interfaces : data.interface_key => data }
  switch_stack_id = each.value.switch_stack_id
  network_id      = each.value.network_id
  # default_gateway = try(each.value.data.default_gateway, null)
  # interface_id      = try(each.value.data.interface_id, null)
  interface_ip      = try(each.value.data.interface_ip, null)
  ipv6              = try(each.value.data.ipv6, null)
  multicast_routing = try(each.value.data.multicast_routing, null)
  name              = try(each.value.data.name, null)
  ospf_settings     = try(each.value.data.ospf_settings, null)
  # ospf_v3           = try(each.value.data.ospf_v3, null)
  subnet  = try(each.value.data.subnet, null)
  vlan_id = try(each.value.data.vlan_id, null)
}

It still adds the default gateway though:

2024-07-08T10:43:08.781+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ==============================================================================
2024-07-08T10:43:08.781+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ~~~ REQUEST ~~~
2024-07-08T10:43:08.781+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: PUT  /api/v1/networks/L_709316941310853998/switch/stacks/709316941310853242/routing/interfaces/709316941310853275  HTTP/1.1
2024-07-08T10:43:08.781+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: HOST   : api.meraki.com
2024-07-08T10:43:08.781+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: HEADERS:
2024-07-08T10:43:08.781+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Accept: application/json
2024-07-08T10:43:08.781+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Authorization: Bearer ****b91c9
2024-07-08T10:43:08.781+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Content-Type: application/json
2024-07-08T10:43:08.782+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   User-Agent: go-meraki/1.44.1 MerakiTerraform/1.47.0 Cisco
2024-07-08T10:43:08.782+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: BODY   :
2024-07-08T10:43:08.782+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: {
2024-07-08T10:43:08.782+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "defaultGateway": "10.11.12.99",
2024-07-08T10:43:08.782+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "interfaceIp": "10.11.12.2",
2024-07-08T10:43:08.782+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "ipv6": {
2024-07-08T10:43:08.782+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       "address": "2:20:3:4::1",
2024-07-08T10:43:08.782+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       "assignmentMode": "static",
2024-07-08T10:43:08.784+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       "prefix": "2:20:3:4::/64"
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    },
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "multicastRouting": "disabled",
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "name": "test",
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "ospfSettings": {
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       "area": "ospfDisabled"
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    },
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "subnet": "10.11.12.0/24",
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "vlanId": 100
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: }
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ------------------------------------------------------------------------------
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ~~~ RESPONSE ~~~
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: STATUS       : 400 Bad Request
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: PROTO        : HTTP/2.0
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: RECEIVED AT  : 2024-07-08T10:43:08.780205+02:00
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: TIME DURATION: 114.232958ms
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: HEADERS      :
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Cache-Control: no-cache, no-store, max-age=0, must-revalidate
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Content-Type: application/json; charset=utf-8
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Date: Mon, 08 Jul 2024 08:43:08 GMT
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Expires: Fri, 01 Jan 1990 00:00:00 GMT
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Pragma: no-cache
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   Strict-Transport-Security: max-age=31536000; includeSubDomains
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   X-Content-Type-Options: nosniff
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   X-Frame-Options: sameorigin
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   X-Request-Id: 7b333ce5d2d34c6e5db4ce1aebd5814e
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   X-Robots-Tag: none
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   X-Runtime: 0.065100
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:   X-Xss-Protection: 1; mode=block
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: BODY         :
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: {
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    "errors": [
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:       "Parameter 'defaultGateway' to be set once and is already configured with a different layer 3 interface."
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha:    ]
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: }
2024-07-08T10:43:08.785+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.5-alpha: ==============================================================================

Expected behavior Do not include the "default gateway" argument in the request.

Environment (please complete the following information):

fmunozmiranda commented 4 months ago

@mcparaf please try it again with new version and update us.

fmunozmiranda commented 3 months ago

If we do not receive a response it will be closed in the next 24 hours.