Skip to content

Commit 50e2420

Browse files
authored
Fix the rest of application type value custom formats (#81)
1 parent 64d2133 commit 50e2420

22 files changed

+458
-74
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.3.0 (unreleased)
2+
3+
- Fix API format of `definitions[].value` attribute of `meraki_appliance_traffic_shaping_rules` resource, [link](https://github.com/CiscoDevNet/terraform-provider-meraki/pull/81)
4+
- Fix API format of `l7_firewall_rules[].value` attribute of `meraki_network_group_policy` resource, [link](https://github.com/CiscoDevNet/terraform-provider-meraki/pull/81)
5+
- Fix API format of `traffic_shaping_rules[].definitions[].value` attribute of `meraki_network_group_policy` resource, [link](https://github.com/CiscoDevNet/terraform-provider-meraki/pull/81)
6+
- Fix API format of `rules[].value` attribute of `meraki_wireless_ssid_l7_firewall_rules` resource, [link](https://github.com/CiscoDevNet/terraform-provider-meraki/pull/81)
7+
18
## 1.2.0
29

310
- Handle HTTP error code `400` correctly when trying to read non-existent resources

docs/data-sources/appliance_traffic_shaping_rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ Read-Only:
4949
Read-Only:
5050

5151
- `type` (String) The type of definition. Can be one of `application`, `applicationCategory`, `host`, `port`, `ipRange` or `localNet`.
52-
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an object with the structure { 'id': 'meraki:layer7/...' }, where 'id' is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
52+
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).

docs/data-sources/network_group_policies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Read-Only:
107107

108108
- `policy` (String) The policy applied to matching traffic. Must be `deny`.
109109
- `type` (String) Type of the L7 Rule. Must be `application`, `applicationCategory`, `host`, `port` or `ipRange`
110-
- `value` (String) The `value` of what you want to block. If `type` is `host`, `port` or `ipRange`, `value` must be a string matching either a hostname (e.g. somewhere.com), a port (e.g. 8080), or an IP range (e.g. 192.1.0.0/16). If `type` is `application` or `applicationCategory`, then `value` must be an object with an ID for the application.
110+
- `value` (String) The `value` of what you want to block. If `type` is `host`, `port` or `ipRange`, `value` must be a string matching either a hostname (e.g. somewhere.com), a port (e.g. 8080), or an IP range (e.g. 192.1.0.0/16). If `type` is `application` or `applicationCategory`, then `value` must be an ID for the application.
111111

112112

113113
<a id="nestedatt--items--traffic_shaping_rules"></a>
@@ -129,4 +129,4 @@ Read-Only:
129129
Read-Only:
130130

131131
- `type` (String) The type of definition. Can be one of `application`, `applicationCategory`, `host`, `port`, `ipRange` or `localNet`.
132-
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an object with the structure { 'id': 'meraki:layer7/...' }, where 'id' is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
132+
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).

docs/data-sources/network_group_policy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Read-Only:
104104

105105
- `policy` (String) The policy applied to matching traffic. Must be `deny`.
106106
- `type` (String) Type of the L7 Rule. Must be `application`, `applicationCategory`, `host`, `port` or `ipRange`
107-
- `value` (String) The `value` of what you want to block. If `type` is `host`, `port` or `ipRange`, `value` must be a string matching either a hostname (e.g. somewhere.com), a port (e.g. 8080), or an IP range (e.g. 192.1.0.0/16). If `type` is `application` or `applicationCategory`, then `value` must be an object with an ID for the application.
107+
- `value` (String) The `value` of what you want to block. If `type` is `host`, `port` or `ipRange`, `value` must be a string matching either a hostname (e.g. somewhere.com), a port (e.g. 8080), or an IP range (e.g. 192.1.0.0/16). If `type` is `application` or `applicationCategory`, then `value` must be an ID for the application.
108108

109109

110110
<a id="nestedatt--traffic_shaping_rules"></a>
@@ -126,4 +126,4 @@ Read-Only:
126126
Read-Only:
127127

128128
- `type` (String) The type of definition. Can be one of `application`, `applicationCategory`, `host`, `port`, `ipRange` or `localNet`.
129-
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an object with the structure { 'id': 'meraki:layer7/...' }, where 'id' is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
129+
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).

docs/guides/changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ description: |-
77

88
# Changelog
99

10+
## 1.3.0 (unreleased)
11+
12+
- Fix API format of `definitions[].value` attribute of `meraki_appliance_traffic_shaping_rules` resource, [link](https://github.com/CiscoDevNet/terraform-provider-meraki/pull/81)
13+
- Fix API format of `l7_firewall_rules[].value` attribute of `meraki_network_group_policy` resource, [link](https://github.com/CiscoDevNet/terraform-provider-meraki/pull/81)
14+
- Fix API format of `traffic_shaping_rules[].definitions[].value` attribute of `meraki_network_group_policy` resource, [link](https://github.com/CiscoDevNet/terraform-provider-meraki/pull/81)
15+
- Fix API format of `rules[].value` attribute of `meraki_wireless_ssid_l7_firewall_rules` resource, [link](https://github.com/CiscoDevNet/terraform-provider-meraki/pull/81)
16+
1017
## 1.2.0
1118

1219
- Handle HTTP error code `400` correctly when trying to read non-existent resources

docs/resources/appliance_traffic_shaping_rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Required:
7272

7373
- `type` (String) The type of definition. Can be one of `application`, `applicationCategory`, `host`, `port`, `ipRange` or `localNet`.
7474
- Choices: `application`, `applicationCategory`, `host`, `ipRange`, `localNet`, `port`
75-
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an object with the structure { 'id': 'meraki:layer7/...' }, where 'id' is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
75+
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
7676

7777
## Import
7878

docs/resources/network_group_policy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Optional:
190190
- Choices: `deny`
191191
- `type` (String) Type of the L7 Rule. Must be `application`, `applicationCategory`, `host`, `port` or `ipRange`
192192
- Choices: `application`, `applicationCategory`, `host`, `ipRange`, `port`
193-
- `value` (String) The `value` of what you want to block. If `type` is `host`, `port` or `ipRange`, `value` must be a string matching either a hostname (e.g. somewhere.com), a port (e.g. 8080), or an IP range (e.g. 192.1.0.0/16). If `type` is `application` or `applicationCategory`, then `value` must be an object with an ID for the application.
193+
- `value` (String) The `value` of what you want to block. If `type` is `host`, `port` or `ipRange`, `value` must be a string matching either a hostname (e.g. somewhere.com), a port (e.g. 8080), or an IP range (e.g. 192.1.0.0/16). If `type` is `application` or `applicationCategory`, then `value` must be an ID for the application.
194194

195195

196196
<a id="nestedatt--traffic_shaping_rules"></a>
@@ -216,7 +216,7 @@ Required:
216216

217217
- `type` (String) The type of definition. Can be one of `application`, `applicationCategory`, `host`, `port`, `ipRange` or `localNet`.
218218
- Choices: `application`, `applicationCategory`, `host`, `ipRange`, `localNet`, `port`
219-
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an object with the structure { 'id': 'meraki:layer7/...' }, where 'id' is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
219+
- `value` (String) If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
220220

221221
## Import
222222

gen/definitions/appliance_traffic_shaping_rules.yaml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ attributes:
6565
type: String
6666
id: true
6767
mandatory: true
68-
description: 'If ''type'' is `host`, `port`, `ipRange` or `localNet`, then ''value'' must be a string, matching either a hostname (e.g. ''somesite.com''), a port (e.g. 8080), or an IP range (''192.1.0.0'', ''192.1.0.0/16'', or ''10.1.0.0/16:80''). `localNet` also supports CIDR notation, excluding custom ports. If ''type'' is `application` or `applicationCategory`, then ''value'' must be an object with the structure { ''id'': ''meraki:layer7/...'' }, where ''id'' is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).'
68+
description: If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
6969
example: google.com
7070
test_prerequisites: |
7171
data "meraki_organization" "test" {
@@ -76,3 +76,46 @@ test_prerequisites: |
7676
name = var.test_network
7777
product_types = ["switch", "wireless", "appliance"]
7878
}
79+
additional_tests:
80+
- |-
81+
resource "meraki_appliance_traffic_shaping_rules" "test" {
82+
network_id = meraki_network.test.id
83+
rules = [
84+
{
85+
definitions = [
86+
{
87+
type = "application"
88+
value = "meraki:layer7/application/171"
89+
},
90+
{
91+
type = "host"
92+
value = "google.com"
93+
},
94+
{
95+
type = "port"
96+
value = "9091"
97+
},
98+
{
99+
type = "applicationCategory"
100+
value = "meraki:layer7/category/27"
101+
},
102+
{
103+
type = "application"
104+
value = "meraki:layer7/application/133"
105+
},
106+
{
107+
type = "ipRange"
108+
value = "192.168.0.3/16:80"
109+
},
110+
{
111+
type = "localNet"
112+
value = "192.168.2.4/16"
113+
},
114+
{
115+
type = "host"
116+
value = "test.com"
117+
}
118+
]
119+
}
120+
]
121+
}

gen/definitions/network_group_policy.yaml

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ attributes:
168168
enum_values: [application, applicationCategory, host, ipRange, port]
169169
- model_name: value
170170
type: String
171-
description: The `value` of what you want to block. If `type` is `host`, `port` or `ipRange`, `value` must be a string matching either a hostname (e.g. somewhere.com), a port (e.g. 8080), or an IP range (e.g. 192.1.0.0/16). If `type` is `application` or `applicationCategory`, then `value` must be an object with an ID for the application.
171+
description: The `value` of what you want to block. If `type` is `host`, `port` or `ipRange`, `value` must be a string matching either a hostname (e.g. somewhere.com), a port (e.g. 8080), or an IP range (e.g. 192.1.0.0/16). If `type` is `application` or `applicationCategory`, then `value` must be an ID for the application.
172172
example: google.com
173173
- model_name: trafficShapingRules
174174
tf_name: traffic_shaping_rules
@@ -221,7 +221,7 @@ attributes:
221221
type: String
222222
id: true
223223
mandatory: true
224-
description: 'If ''type'' is `host`, `port`, `ipRange` or `localNet`, then ''value'' must be a string, matching either a hostname (e.g. ''somesite.com''), a port (e.g. 8080), or an IP range (''192.1.0.0'', ''192.1.0.0/16'', or ''10.1.0.0/16:80''). `localNet` also supports CIDR notation, excluding custom ports. If ''type'' is `application` or `applicationCategory`, then ''value'' must be an object with the structure { ''id'': ''meraki:layer7/...'' }, where ''id'' is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).'
224+
description: If 'type' is `host`, `port`, `ipRange` or `localNet`, then 'value' must be a string, matching either a hostname (e.g. 'somesite.com'), a port (e.g. 8080), or an IP range ('192.1.0.0', '192.1.0.0/16', or '10.1.0.0/16:80'). `localNet` also supports CIDR notation, excluding custom ports. If 'type' is `application` or `applicationCategory`, then 'value' must be an application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
225225
example: google.com
226226
- model_name: enabled
227227
type: Bool
@@ -364,3 +364,78 @@ additional_tests:
364364
name = "No video streaming"
365365
force_delete = true
366366
}
367+
- |-
368+
resource "meraki_network_group_policy" "test" {
369+
network_id = meraki_network.test.id
370+
name = "No video streaming"
371+
l7_firewall_rules = [
372+
{
373+
policy = "deny"
374+
type = "host"
375+
value = "google.com"
376+
},
377+
{
378+
policy = "deny"
379+
type = "port"
380+
value = "9091"
381+
},
382+
{
383+
policy = "deny"
384+
type = "ipRange"
385+
value = "192.168.0.3/16:80"
386+
},
387+
{
388+
policy = "deny"
389+
type = "application"
390+
value = "meraki:layer7/application/171"
391+
},
392+
{
393+
policy = "deny"
394+
type = "applicationCategory"
395+
value = "meraki:layer7/category/17"
396+
}
397+
]
398+
}
399+
- |-
400+
resource "meraki_network_group_policy" "test" {
401+
network_id = meraki_network.test.id
402+
name = "No video streaming"
403+
traffic_shaping_rules = [
404+
{
405+
definitions = [
406+
{
407+
type = "application"
408+
value = "meraki:layer7/application/171"
409+
},
410+
{
411+
type = "host"
412+
value = "google.com"
413+
},
414+
{
415+
type = "port"
416+
value = "9091"
417+
},
418+
{
419+
type = "applicationCategory"
420+
value = "meraki:layer7/category/27"
421+
},
422+
{
423+
type = "application"
424+
value = "meraki:layer7/application/133"
425+
},
426+
{
427+
type = "ipRange"
428+
value = "192.168.0.3/16:80"
429+
},
430+
{
431+
type = "localNet"
432+
value = "192.168.2.4/16"
433+
},
434+
{
435+
type = "host"
436+
value = "test.com"
437+
}
438+
]
439+
}
440+
]
441+
}

gen/definitions/wireless_ssid_l7_firewall_rules.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,36 @@ test_prerequisites: |
5454
number = "0"
5555
name = "My SSID"
5656
}
57+
additional_tests:
58+
- |-
59+
resource "meraki_wireless_ssid_l7_firewall_rules" "test" {
60+
network_id = meraki_network.test.id
61+
number = meraki_wireless_ssid.test.id
62+
rules = [
63+
{
64+
policy = "deny"
65+
type = "host"
66+
value = "google.com"
67+
},
68+
{
69+
policy = "deny"
70+
type = "port"
71+
value = "9091"
72+
},
73+
{
74+
policy = "deny"
75+
type = "ipRange"
76+
value = "192.168.0.3/16:80"
77+
},
78+
{
79+
policy = "deny"
80+
type = "application"
81+
value = "meraki:layer7/application/171"
82+
},
83+
{
84+
policy = "deny"
85+
type = "applicationCategory"
86+
value = "meraki:layer7/category/17"
87+
}
88+
]
89+
}

0 commit comments

Comments
 (0)