Skip to content

unable to set empty attributes list | multiple resources #128

@rrahimm

Description

@rrahimm

To be able to delete the list of values in a resource, we are trying to send an empty attributes list from Terraform. The Terraform plan shows the same, however, empty list is not sent in API payload.

we are seeing this same behaviour in multiple other resources that use similar structure.

We are referring the resource `meraki_appliance_security_malware' and attribute list allowed_urls in the below example.

This shows Terraform plan attempting send a empty list, however the API debug shows the empty list was never sent in payload. We are expecting the provider to pass on the empty list to the API, so that we are able to clear the list of already configured values.

Terraform apply - Enable AMP and add URL's

  # module.meraki.meraki_appliance_security_malware.networks_appliance_security_malware["domain_name_1/Demo Meraki Lab/Test Branch 3"] will be created
  + resource "meraki_appliance_security_malware" "networks_appliance_security_malware" {
      + allowed_urls = [
          + {
              + comment = "cisco website"
              + url     = "https://cisco.com"
            },
          + {
              + comment = "meraki website"
              + url     = "https://meraki.com"
            },
        ]
      + id           = (known after apply)
      + mode         = "enabled"
      + network_id   = "L_762234236932477311"
    }

API Debug

v1.7.1: 2025/11/03 18:15:25 REQUEST --------------------------
v1.7.1: 2025/11/03 18:15:25 PUT https://api.meraki.com/api/v1/networks/L_762234236932477311/appliance/security/malware
v1.7.1: 2025/11/03 18:15:25 Authorization: ****
v1.7.1: 2025/11/03 18:15:25 User-Agent: [go-meraki netascode]
v1.7.1: 2025/11/03 18:15:25 Content-Type: [application/json]
v1.7.1: 2025/11/03 18:15:25 Accept: [application/json]
v1.7.1: 2025/11/03 18:15:25 --------------------------
v1.7.1: 2025/11/03 18:15:25 {
v1.7.1: 2025/11/03 18:15:25   "allowedUrls": [
v1.7.1: 2025/11/03 18:15:25     {
v1.7.1: 2025/11/03 18:15:25       "comment": "cisco website",
v1.7.1: 2025/11/03 18:15:25       "url": "https://cisco.com"
v1.7.1: 2025/11/03 18:15:25     },
v1.7.1: 2025/11/03 18:15:25     {
v1.7.1: 2025/11/03 18:15:25       "comment": "meraki website",
v1.7.1: 2025/11/03 18:15:25       "url": "https://meraki.com"
v1.7.1: 2025/11/03 18:15:25     }
v1.7.1: 2025/11/03 18:15:25   ],
v1.7.1: 2025/11/03 18:15:25   "mode": "enabled"
v1.7.1: 2025/11/03 18:15:25 }
v1.7.1: 2025/11/03 18:15:26 RESPONSE 200 --------------------------
v1.7.1: 2025/11/03 18:15:26 {
v1.7.1: 2025/11/03 18:15:26   "allowedFiles": [],
v1.7.1: 2025/11/03 18:15:26   "allowedUrls": [
v1.7.1: 2025/11/03 18:15:26     {
v1.7.1: 2025/11/03 18:15:26       "comment": "cisco website",
v1.7.1: 2025/11/03 18:15:26       "url": "https://cisco.com"
v1.7.1: 2025/11/03 18:15:26     },
v1.7.1: 2025/11/03 18:15:26     {
v1.7.1: 2025/11/03 18:15:26       "comment": "meraki website",
v1.7.1: 2025/11/03 18:15:26       "url": "https://meraki.com"
v1.7.1: 2025/11/03 18:15:26     }
v1.7.1: 2025/11/03 18:15:26   ],
v1.7.1: 2025/11/03 18:15:26   "mode": "enabled"
v1.7.1: 2025/11/03 18:15:26 }
v1.7.1: 2025/11/03 18:15:26 --------------------------

Remove AMP URL's

  # module.meraki.meraki_appliance_security_malware.networks_appliance_security_malware["domain_name_1/Demo Meraki Lab/Test Branch 3"] will be updated in-place
  ~ resource "meraki_appliance_security_malware" "networks_appliance_security_malware" {
      ~ allowed_urls = [
          - {
              - comment = "cisco website" -> null
              - url     = "https://cisco.com" -> null
            },
          - {
              - comment = "meraki website" -> null
              - url     = "https://meraki.com" -> null
            },
        ]
        id           = "L_762234236932477311"
        # (2 unchanged attributes hidden)
    }

API Debug shows, the empty list for allowedUrls was never sent out.

v1.7.1: 2025/11/03 18:18:22 REQUEST --------------------------
v1.7.1: 2025/11/03 18:18:22 PUT https://api.meraki.com/api/v1/networks/L_762234236932477311/appliance/security/malware
v1.7.1: 2025/11/03 18:18:22 Content-Type: [application/json]
v1.7.1: 2025/11/03 18:18:22 Accept: [application/json]
v1.7.1: 2025/11/03 18:18:22 Authorization: ****
v1.7.1: 2025/11/03 18:18:22 User-Agent: [go-meraki netascode]
v1.7.1: 2025/11/03 18:18:22 --------------------------
v1.7.1: 2025/11/03 18:18:22 {
v1.7.1: 2025/11/03 18:18:22   "mode": "enabled"
v1.7.1: 2025/11/03 18:18:22 }
v1.7.1: 2025/11/03 18:18:23 RESPONSE 200 --------------------------
v1.7.1: 2025/11/03 18:18:23 {
v1.7.1: 2025/11/03 18:18:23   "allowedFiles": [],
v1.7.1: 2025/11/03 18:18:23   "allowedUrls": [
v1.7.1: 2025/11/03 18:18:23     {
v1.7.1: 2025/11/03 18:18:23       "comment": "cisco website",
v1.7.1: 2025/11/03 18:18:23       "url": "https://cisco.com"
v1.7.1: 2025/11/03 18:18:23     },
v1.7.1: 2025/11/03 18:18:23     {
v1.7.1: 2025/11/03 18:18:23       "comment": "meraki website",
v1.7.1: 2025/11/03 18:18:23       "url": "https://meraki.com"
v1.7.1: 2025/11/03 18:18:23     }
v1.7.1: 2025/11/03 18:18:23   ],
v1.7.1: 2025/11/03 18:18:23   "mode": "enabled"
v1.7.1: 2025/11/03 18:18:23 }
v1.7.1: 2025/11/03 18:18:23 --------------------------

Direct testing with API

PUT Payload

{
    "mode": "enabled",
    "allowedUrls": [],
    "allowedFiles": []
}

Response

{"mode":"enabled","allowedUrls":[],"allowedFiles":[]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions