cisco-open / terraform-provider-meraki

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

meraki_organizations_snmp - modified read only fields #123

Closed mcparaf closed 1 month ago

mcparaf commented 3 months ago

Prerequisites

Describe the bug When running any update Terraform shows snmp resources as modified in place:

  # module.meraki.meraki_organizations_snmp.snmp["1576869"] will be updated in-place
  ~ resource "meraki_organizations_snmp" "snmp" {
      ~ hostname            = "snmp.meraki.com" -> (known after apply)
      + peer_ips            = []
      ~ port                = 16100 -> (known after apply)
      + v2_community_string = (known after apply)
      + v3_auth_pass        = "abc12345"
      + v3_priv_pass        = "cde12345"
      ~ v3_user             = "o/6UlUga" -> (known after apply)
        # (5 unchanged attributes hidden)
    }

hostname, port, and v3_user are undocumented fields that are also read only. They should not be modifiable, nor should they trigger a resource update. We also do not use them anywhere in our code:

resource "meraki_organizations_snmp" "snmp" {
  for_each = { for snmp in local.snmp : snmp.organization_id => snmp }

  organization_id = each.value.organization_id
  v2c_enabled     = each.value.v2c_enabled
  v3_enabled      = each.value.v3_enabled
  v3_auth_mode    = each.value.v3_auth_mode
  v3_auth_pass    = each.value.v3_auth_pass
  v3_priv_mode    = each.value.v3_priv_mode
  v3_priv_pass    = each.value.v3_priv_pass
  peer_ips        = each.value.peer_ips
}

Expected behavior No changes in the declared resources result in no changes executed by Terraform.

Environment (please complete the following information):

fmunozmiranda commented 3 months ago

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

mcparaf commented 3 months ago

The peer_ips field still has the same problem:


  # module.meraki.meraki_organizations_snmp.snmp["1576797"] will be updated in-place
  ~ resource "meraki_organizations_snmp" "snmp" {
      + peer_ips            = []
        # (11 unchanged attributes hidden)
    }

  # module.meraki.meraki_organizations_snmp.snmp["1576869"] will be updated in-place
  ~ resource "meraki_organizations_snmp" "snmp" {
      + peer_ips            = []
        # (11 unchanged attributes hidden)
    }

  # module.meraki.meraki_organizations_snmp.snmp["709316941310853137"] will be updated in-place
  ~ resource "meraki_organizations_snmp" "snmp" {
      + peer_ips            = []
        # (11 unchanged attributes hidden)
    }
fmunozmiranda commented 2 months ago

Please try it with new version and update us.

mcparaf commented 2 months ago

Now if peer_ips is null on creation of the resource this happens:

╷
│ Error: Value Conversion Error
│
│   with module.meraki.meraki_organizations_snmp.snmp["1576797"],
│   on ../terraform-meraki-nac-meraki/meraki_organization.tf line 100, in resource "meraki_organizations_snmp" "snmp":
│  100:   peer_ips        = each.value.peer_ips
│
│ An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. This is always an error in the provider. Please report the following to the provider developer:
│
│ Expected framework type from provider logic: types.SetType[basetypes.StringType] / underlying type: tftypes.Set[tftypes.String]
│ Received framework type from provider logic: types.SetType[!!! MISSING TYPE !!!] / underlying type: tftypes.Set[tftypes.DynamicPseudoType]
│ Path: peer_ips
╵

This does not happen on update.

fmunozmiranda commented 1 month ago

Please try it with new version and update us.

fmunozmiranda commented 1 month ago

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