Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meraki_networks_switch_link_aggregations - no id in delete request path #149

Closed
mcparaf opened this issue Aug 29, 2024 · 2 comments
Closed

Comments

@mcparaf
Copy link

mcparaf commented Aug 29, 2024

When trying to delete a switch link aggregation the path is incomplete, the id parameter is missing, even though the id is known to the provider and I made sure to supply the same data in link_aggregation_id.

module.meraki.meraki_networks_switch_link_aggregations.net_switch_link_aggregations["0"]: Destroying... [id=c3RhY2tfYWdncl83MDkzMTY5NDEzMTA4NTM0NzlfMA==]
2024-08-29T12:15:38.230+0200 [INFO]  Starting apply for module.meraki.meraki_networks_switch_link_aggregations.net_switch_link_aggregations["0"]
2024-08-29T12:15:38.230+0200 [DEBUG] module.meraki.meraki_networks_switch_link_aggregations.net_switch_link_aggregations["0"]: applying the planned Delete change
2024-08-29T12:15:38.481+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 2024/08/29 12:15:38
2024-08-29T12:15:38.481+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: ==============================================================================
2024-08-29T12:15:38.481+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: ~~~ REQUEST(curl) ~~~
2024-08-29T12:15:38.481+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: CURL:
2024-08-29T12:15:38.481+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	curl -X DELETE -H 'Accept: application/json' -H 'Authorization: Bearer ****tions/
2024-08-29T12:15:38.482+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: ~~~ REQUEST ~~~
2024-08-29T12:15:38.482+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: DELETE  /api/v1/networks/L_709316941310856179/switch/linkAggregations/  HTTP/1.1
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: HOST   : api.meraki.com
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: HEADERS:
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	Accept: application/json
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	Authorization: Bearer ****b91c9
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	Content-Type: application/json
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	User-Agent: go-meraki/1.44.1 MerakiTerraform/1.47.0 Cisco
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: BODY   :
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: ***** NO CONTENT *****
2024-08-29T12:15:38.484+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: ------------------------------------------------------------------------------
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: ~~~ RESPONSE ~~~
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: STATUS       : 404 Not Found
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: PROTO        : HTTP/2.0
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: RECEIVED AT  : 2024-08-29T12:15:38.480695+02:00
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: TIME DURATION: 249.699166ms
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: HEADERS      :
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	Content-Length: 36
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	Content-Type: application/json; charset=utf-8
2024-08-29T12:15:38.485+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	Date: Thu, 29 Aug 2024 10:15:38 GMT
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	Strict-Transport-Security: max-age=31536000; includeSubDomains
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	X-Request-Id: aac5204414f6dde7387414b2f5a9a552
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: 	X-Runtime: 0.008774
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: BODY         :
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: {
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha:    "status": "404",
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha:    "error": "Not Found"
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: }
2024-08-29T12:15:38.486+0200 [DEBUG] provider.terraform-provider-meraki_v0.2.11-alpha: ==============================================================================

Successful curl:

curl -v -XDELETE -H "Content-Type: application/json" -H "Authorization: Bearer REDACTED" https://api.meraki.com/api/v1/networks/L_709316941310856179/switch/linkAggregations/c3RhY2tfYWdncl83MDkzMTY5NDEzMTA4NTM0NzlfMA==

The code that I wrote to supply data to the module:

data "meraki_networks_switch_link_aggregations" "data_switch_link_aggregations" {
  for_each = {for net in meraki_networks.networks : net.id => net}
  network_id = each.key
}

resource "meraki_networks_switch_link_aggregations" "net_switch_link_aggregations" {
  for_each   = { for i, v in local.networks_switch_link_aggregations : i => v }
  network_id = each.value.network_id
  # id = try(each.value.data.id, null)
  switch_ports         = try(each.value.data.switch_ports, local.defaults.meraki.networks.switch_link_aggregations.switch_ports, null)
  switch_profile_ports = try(each.value.data.switch_profile_ports, local.defaults.meraki.networks.switch_link_aggregations.switch_profile_ports, null)
  link_aggregation_id = data.meraki_networks_switch_link_aggregations.data_switch_link_aggregations[each.value.network_id].items[0].id
  depends_on = [ meraki_networks_devices_claim.net_device_claims ]
}

I also checked using terraform outputs that the data that I was receiving from the data source was correct.

@fmunozmiranda
Copy link
Collaborator

Please try it with new version and update us.

@fmunozmiranda
Copy link
Collaborator

if we don´t get answer in next 24 hours issue will be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants