Skip to content

Commit

Permalink
cellular gateway resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Parafiniuk committed Feb 11, 2025
1 parent 4c440fa commit 423df6a
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,14 @@ module "meraki" {
| [meraki_appliance_vpn_firewall_rules.organizations_vpn_firewall_rules](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/appliance_vpn_firewall_rules) | resource |
| [meraki_appliance_warm_spare.appliance_warm_spare](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/appliance_warm_spare) | resource |
| [meraki_device.device](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/device) | resource |
| [meraki_device_cellular_gateway_lan.net_devices_cellular_gateway_lan](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/device_cellular_gateway_lan) | resource |
| [meraki_device_cellular_gateway_port_forwarding_rules.net_devices_cellular_gateway_port_forwarding_rules](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/device_cellular_gateway_port_forwarding_rules) | resource |
| [meraki_device_management_interface.devices_management_interface](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/device_management_interface) | resource |
| [meraki_network.network](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/network) | resource |
| [meraki_network_cellular_gateway_connectivity_monitoring_destinations.net_networks_cellular_gateway_connectivity_monitoring_destinations](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/network_cellular_gateway_connectivity_monitoring_destinations) | resource |
| [meraki_network_cellular_gateway_dhcp.net_networks_cellular_gateway_dhcp](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/network_cellular_gateway_dhcp) | resource |
| [meraki_network_cellular_gateway_subnet_pool.net_networks_cellular_gateway_subnet_pool](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/network_cellular_gateway_subnet_pool) | resource |
| [meraki_network_cellular_gateway_uplink.net_networks_cellular_gateway_uplink](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/network_cellular_gateway_uplink) | resource |
| [meraki_network_device_claim.net_device_claim](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/network_device_claim) | resource |
| [meraki_network_floor_plan.net_floor_plans](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/network_floor_plan) | resource |
| [meraki_network_group_policy.net_group_policies](https://registry.terraform.io/providers/CiscoDevNet/meraki/latest/docs/resources/network_group_policy) | resource |
Expand Down
2 changes: 1 addition & 1 deletion gen/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

URL = sys.argv[1]
OPEN_API_SPEC_PATH = "/meraki/openapi/spec3.json"
OPEN_API_SPEC_PATH = "/Users/maparafi/openapi/openapi/spec3.json"


def to_snake_case(text):
Expand Down
51 changes: 51 additions & 0 deletions meraki_devices.tf
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,54 @@ resource "meraki_wireless_device_bluetooth_settings" "devices_wireless_bluetooth
major = try(each.value.data.major, local.defaults.meraki.networks.devices_wireless_bluetooth_settings.major, null)
minor = try(each.value.data.minor, local.defaults.meraki.networks.devices_wireless_bluetooth_settings.minor, null)
}

locals {
networks_devices_cellular_gateway_lan = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : [
for device in try(network.devices, []) : {
serial = meraki_device.device["${organization.name}/${network.name}/devices/${device.name}"].serial

data = try(device.cellular.gateway.lan, null)
} if try(device.cellular.gateway.lan, null) != null
] if try(organization.networks, null) != null
] if try(domain.organizations, null) != null
] if try(local.meraki.domains, null) != null
])
}

resource "meraki_device_cellular_gateway_lan" "net_devices_cellular_gateway_lan" {
for_each = { for i, v in local.networks_devices_cellular_gateway_lan : i => v }
serial = each.value.serial

reserved_ip_ranges = try(each.value.data.reserved_ip_ranges, local.defaults.meraki.networks.devices_cellular_gateway_lan.reserved_ip_ranges, null)
fixed_ip_assignments = try(each.value.data.fixed_ip_assignments, local.defaults.meraki.networks.devices_cellular_gateway_lan.fixed_ip_assignments, null)

}

locals {
networks_devices_cellular_gateway_port_forwarding_rules = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : [
for device in try(network.devices, []) : {
serial = meraki_device.device["${organization.name}/${network.name}/devices/${device.name}"].serial

data = try(device.cellular.gateway.port_forwarding_rules, null)
} if try(device.cellular.gateway.lan, null) != null
] if try(organization.networks, null) != null
] if try(domain.organizations, null) != null
] if try(local.meraki.domains, null) != null
])
}

resource "meraki_device_cellular_gateway_port_forwarding_rules" "net_devices_cellular_gateway_port_forwarding_rules" {
for_each = { for i, v in local.networks_devices_cellular_gateway_port_forwarding_rules : i => v }
serial = each.value.serial

rules = try(each.value.data.rules, local.defaults.meraki.networks.devices_cellular_gateway_port_forwarding_rules.rules, null)

}
95 changes: 95 additions & 0 deletions meraki_networks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,98 @@ resource "meraki_network_floor_plan" "net_floor_plans" {
depends_on = [meraki_network.network]
}

locals {
networks_networks_cellular_gateway_dhcp = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id

data = try(network.cellular.gateway.dhcp, null)
} if try(network.cellular.gateway.dhcp, null) != null
] if try(domain.organizations, null) != null
] if try(local.meraki.domains, null) != null
])
}

resource "meraki_network_cellular_gateway_dhcp" "net_networks_cellular_gateway_dhcp" {
for_each = { for i, v in local.networks_networks_cellular_gateway_dhcp : i => v }
network_id = each.value.network_id

dhcp_lease_time = try(each.value.data.dhcp_lease_time, local.defaults.meraki.networks.networks_cellular_gateway_dhcp.dhcp_lease_time, null)
dns_nameservers = try(each.value.data.dns_nameservers, local.defaults.meraki.networks.networks_cellular_gateway_dhcp.dns_nameservers, null)
dns_custom_nameservers = try(each.value.data.dns_custom_nameservers, local.defaults.meraki.networks.networks_cellular_gateway_dhcp.dns_custom_nameservers, null)

}

locals {
networks_networks_cellular_gateway_subnet_pool = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id

data = try(network.cellular.gateway.subnet_pool, null)
} if try(network.cellular.gateway.subnet_pool, null) != null
] if try(domain.organizations, null) != null
] if try(local.meraki.domains, null) != null
])
}

resource "meraki_network_cellular_gateway_subnet_pool" "net_networks_cellular_gateway_subnet_pool" {
for_each = { for i, v in local.networks_networks_cellular_gateway_subnet_pool : i => v }
network_id = each.value.network_id

mask = try(each.value.data.mask, local.defaults.meraki.networks.networks_cellular_gateway_subnet_pool.mask, null)
cidr = try(each.value.data.cidr, local.defaults.meraki.networks.networks_cellular_gateway_subnet_pool.cidr, null)

}

locals {
networks_networks_cellular_gateway_uplink = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id

data = try(network.cellular.gateway.uplink, null)
} if try(network.cellular.gateway.uplink, null) != null
] if try(domain.organizations, null) != null
] if try(local.meraki.domains, null) != null
])
}

resource "meraki_network_cellular_gateway_uplink" "net_networks_cellular_gateway_uplink" {
for_each = { for i, v in local.networks_networks_cellular_gateway_uplink : i => v }
network_id = each.value.network_id

bandwidth_limits_limit_up = try(each.value.data.bandwidth_limits.limit_up, local.defaults.meraki.networks.networks_cellular_gateway_uplink.bandwidth_limits.limit_up, null)
bandwidth_limits_limit_down = try(each.value.data.bandwidth_limits.limit_down, local.defaults.meraki.networks.networks_cellular_gateway_uplink.bandwidth_limits.limit_down, null)

}

locals {
networks_networks_cellular_gateway_connectivity_monitoring_destinations = flatten([

for domain in try(local.meraki.domains, []) : [
for organization in try(domain.organizations, []) : [
for network in try(organization.networks, []) : {
network_id = meraki_network.network["${organization.name}/${network.name}"].id

data = try(network.cellular.gateway.connectivity_monitoring_destinations, null)
} if try(network.cellular.gateway.connectivity_monitoring_destinations, null) != null
] if try(domain.organizations, null) != null
] if try(local.meraki.domains, null) != null
])
}

resource "meraki_network_cellular_gateway_connectivity_monitoring_destinations" "net_networks_cellular_gateway_connectivity_monitoring_destinations" {
for_each = { for i, v in local.networks_networks_cellular_gateway_connectivity_monitoring_destinations : i => v }
network_id = each.value.network_id

destinations = try(each.value.data.destinations, local.defaults.meraki.networks.networks_cellular_gateway_connectivity_monitoring_destinations.destinations, null)

}

0 comments on commit 423df6a

Please sign in to comment.