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_vlan_profiles silently fails when attempting to create a resource on the default profile #94

Closed
3 tasks done
zbuchheit opened this issue Jul 6, 2024 · 5 comments

Comments

@zbuchheit
Copy link

Prerequisites

  • Have you tested the operation in the API directly?
  • Do you have the latest Terraform provider version?
  • Review the compatibility matrix before opening an issue.

Describe the bug

When attemping to create a meraki_networks_vlan_profiles resource/edit the default vlan profile resource, it will fail to actually enact a change despite reporting a success on the create.

Expected behavior

I would likely expect a resource already exists error and with an import required. The default profile is created automatically so it is a bit of a one-off resource that I could see an argument made for doing a PUT on the create in the even the resource is the default profile. This also makes it tricky to handle the delete as you likely can't/wouldn't delete this resource and would just revert the changes back to default.

Screenshots

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

Environment (please complete the following information):

  • Meraki Dashboard version:
  • Terraform version:
  • Meraki provider version:
  • OS Version:

Additional context

I assume this is likely from this recent code changes where it changes from UpdateNetworkVLANProfile to CreateNetworkVLANProfile on the create which would explain the behavior we saw before which would allow changes on the default vlan profiles, but other vlan profile resource creations would fail. This is the opposite behavior I am seeing now.

Also worth noting, if you create the resource on the Default profile where it doesn't actually make a change, you can refresh, then trigger an update, to which the resource will actually update as expected.

Code Example

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

provider "meraki" {
  meraki_debug = "true"
}

resource "meraki_networks_vlan_profiles" "vlan_profiles" {
   network_id = "redacted"
   iname = "Default"
   name = "Default Profile"
   vlan_names = [ {
      name = "default",
      vlan_id = "1"
   }, {
    name = "guest",
    vlan_id = "2"
   }]
   vlan_groups = []
}
fmunozmiranda added a commit that referenced this issue Jul 15, 2024
BUGFIXES:
* Issue #88 fixed.
* Issue #89 fixed.
* Issue #92 fixed.
* Issue #93 fixed.
* Issue #94 fixed.
* Issue #96 fixed.
* Issue #97 fixed.
* Issue #98 fixed.
* Issue #99 fixed.
* Issue #100 fixed.
* Issue #101 fixed.
* Issue #107 fixed.
* Issue #108 fixed.
* Issue #109 fixed.
@fmunozmiranda fmunozmiranda mentioned this issue Jul 15, 2024
1 task
@zbuchheit
Copy link
Author

@fmunozmiranda I see this was mentioned being fixed in the 0.2.6 but I am not seeing a commit where the behavior was changed. Could you confirm this issue was addressed in the 0.2.6 release?

@fmunozmiranda
Copy link
Collaborator

Could you help us sharing the provider DEBUG?

@zbuchheit
Copy link
Author

sure I will provide additional context.

The logs show the following when doing an apply with the above code

2024-07-16T14:55:04.269-0700 [DEBUG] meraki_networks_vlan_profiles.vlan_profiles: applying the planned Create change
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: 2024/07/16 14:55:04 
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: ==============================================================================
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: ~~~ REQUEST ~~~
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: GET  /api/v1/networks/redacted/vlanProfiles/Default  HTTP/1.1
...
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: BODY   :
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: ***** NO CONTENT *****
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: ------------------------------------------------------------------------------
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: ~~~ RESPONSE ~~~
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: STATUS       : 200 OK
...
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: BODY         :
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: {
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:    "name": "Default Profile",
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:    "iname": "Default",
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:    "vlanNames": [
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:       {
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:          "name": "default",
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:          "vlanId": "1"
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:       }
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:    ],
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:    "vlanGroups": [],
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha:    "isDefault": true
2024-07-16T14:55:04.437-0700 [DEBUG] provider.terraform-provider-meraki_v0.2.7-alpha: }

It then saves the vlan_profile into the state.

fmunozmiranda added a commit that referenced this issue Jul 22, 2024
…ate a resource on the default profile

#94
- Resource meraki_networks_sensor_alerts_profiles error with operation CreateNetworkSensorAlertsProfile #91
- Resource meraki_networks_wireless_rf_profiles error when trying to create new profile
#88
fmunozmiranda added a commit that referenced this issue Jul 23, 2024
BUGFIXES:
* meraki_networks_switch_stp - plugin crash when reading #114.
* Failure when executing GetNetworkSwitchRoutingOspf #115.
* meraki_networks_vlan_profiles silently fails when attempting to create a resource on the default profile #94.
* Resource meraki_networks_sensor_alerts_profiles error with operation CreateNetworkSensorAlertsProfile #91.
* Resource meraki_networks_wireless_rf_profiles error when trying to create new profile.
#88.
@fmunozmiranda
Copy link
Collaborator

@zbuchheit please try it again with new version.

@zbuchheit
Copy link
Author

this appears to be fixed. Thanks

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

No branches or pull requests

2 participants