Hi guys, not sure if my title is clear enough as I'm not sure how to word it. I'm not sure if this is terraform issue or provider issue.
I have an appliance in an existing network on Meraki. I want to use terraform to change the port settings on the MX. Currently, Terraform doesn't have the MX's ports in its state file, so here's what I plan to do:
- Retrieve all ports on MX from Meraki using data block, this returns a list of MX's ports and their current settings.
- Create a resource block and use count to iterate the list from data block, define the new settings that I want on those port.
- Add import block to import those ports to terraform state and also update those ports.
When I run terraform plan, terraform shows me the plan as how I want it.

and when I run terraform apply, it said apply successfully. But when I went back to Meraki and check port settings, not all of them are changed. You can see in VLAN columns, some of them are still saying "Drop Untagged Traffic". When in my Terraform code, I want them all changed to Native VLAN 1

here's my terraform code
data "meraki_networks_appliance_ports" "example" {
network_id = module.shop_network["${var.full_shop_num}"].network_id
}
resource "meraki_networks_appliance_ports" "example"{
count = length(data.meraki_networks_appliance_ports.example.items)
port_id = data.meraki_networks_appliance_ports.example.items[count.index].number
network_id = module.shop_network["${var.full_shop_num}"].network_id
allowed_vlans = "all"
drop_untagged_traffic = false
enabled = true
type = "trunk"
vlan = 1
access_policy = null
}
import {
for_each = local.ports
id = each.value.port_id
to = meraki_networks_appliance_ports.example[each.value.port_to]
}
locals {
ports = [for port in data.meraki_networks_appliance_ports.example.items : {
port_id = "${module.shop_network["${var.full_shop_num}"].network_id}, ${port.number}"
port_to = "${index(data.meraki_networks_appliance_ports.example.items, port)}"
}]
}
output "ports" {
value = local.ports
}