Skip to content

Commit 1fe0bb6

Browse files
author
Marcin Parafiniuk
committed
group policies bonjour works
1 parent 62b9a27 commit 1fe0bb6

32 files changed

+1316
-55
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "meraki_network_group_policies Data Source - terraform-provider-meraki"
4+
subcategory: "Networks"
5+
description: |-
6+
This data source can read the Network Group Policies configuration.
7+
---
8+
9+
# meraki_network_group_policies (Data Source)
10+
11+
This data source can read the `Network Group Policies` configuration.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "meraki_network_group_policies" "example" {
17+
id = "L_123456"
18+
network_id = "L_123456"
19+
}
20+
```
21+
22+
<!-- schema generated by tfplugindocs -->
23+
## Schema
24+
25+
### Required
26+
27+
- `network_id` (String) Network ID
28+
29+
### Optional
30+
31+
- `group_policy_id` (String) The id of the object
32+
- `name` (String)
33+
34+
### Read-Only
35+
36+
- `bonjour_forwarding_rules` (Attributes List) (see [below for nested schema](#nestedatt--bonjour_forwarding_rules))
37+
- `bonjour_forwarding_settings` (String)
38+
39+
<a id="nestedatt--bonjour_forwarding_rules"></a>
40+
### Nested Schema for `bonjour_forwarding_rules`
41+
42+
Read-Only:
43+
44+
- `description` (String)
45+
- `services` (List of String)
46+
- `vlan_id` (String)

docs/data-sources/network_settings.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This data source can read the `Network Settings` configuration.
1414

1515
```terraform
1616
data "meraki_network_settings" "example" {
17-
id = "12345678"
17+
id = "L_123456"
1818
network_id = "L_123456"
1919
}
2020
```
@@ -29,4 +29,9 @@ data "meraki_network_settings" "example" {
2929

3030
### Read-Only
3131

32+
- `local_status_page_authentication_enabled` (Boolean)
33+
- `local_status_page_authentication_password` (String)
3234
- `local_status_page_enabled` (Boolean) asdasdas
35+
- `named_vlans_enabled` (Boolean)
36+
- `remote_status_page_enabled` (Boolean)
37+
- `secure_port_enabled` (Boolean)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "meraki_network_group_policies Resource - terraform-provider-meraki"
4+
subcategory: "Networks"
5+
description: |-
6+
This resource can manage the Network Group Policies configuration.
7+
---
8+
9+
# meraki_network_group_policies (Resource)
10+
11+
This resource can manage the `Network Group Policies` configuration.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "meraki_network_group_policies" "example" {
17+
network_id = "L_123456"
18+
name = "test_group_policy"
19+
bonjour_forwarding_settings = "custom"
20+
bonjour_forwarding_rules = [
21+
{
22+
description = "a simple bonjour rule"
23+
services = ["All Services"]
24+
vlan_id = "2"
25+
}
26+
]
27+
}
28+
```
29+
30+
<!-- schema generated by tfplugindocs -->
31+
## Schema
32+
33+
### Required
34+
35+
- `name` (String)
36+
- `network_id` (String) Network ID
37+
38+
### Optional
39+
40+
- `bonjour_forwarding_rules` (Attributes List) (see [below for nested schema](#nestedatt--bonjour_forwarding_rules))
41+
- `bonjour_forwarding_settings` (String)
42+
43+
### Read-Only
44+
45+
- `group_policy_id` (String) The id of the object
46+
47+
<a id="nestedatt--bonjour_forwarding_rules"></a>
48+
### Nested Schema for `bonjour_forwarding_rules`
49+
50+
Optional:
51+
52+
- `description` (String)
53+
- `services` (List of String)
54+
- `vlan_id` (String)
55+
56+
## Import
57+
58+
Import is supported using the following syntax:
59+
60+
```shell
61+
terraform import meraki_network_group_policies.example "<network_id>"
62+
```

docs/resources/network_settings.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ This resource can manage the `Network Settings` configuration.
1414

1515
```terraform
1616
resource "meraki_network_settings" "example" {
17-
network_id = "L_123456"
18-
local_status_page_enabled = false
17+
network_id = "L_123456"
18+
local_status_page_enabled = false
19+
remote_status_page_enabled = false
20+
local_status_page_authentication_enabled = false
21+
local_status_page_authentication_password = "miles123"
22+
named_vlans_enabled = false
23+
secure_port_enabled = false
1924
}
2025
```
2126

@@ -27,6 +32,14 @@ resource "meraki_network_settings" "example" {
2732
- `local_status_page_enabled` (Boolean) asdasdas
2833
- `network_id` (String) Network ID
2934

35+
### Optional
36+
37+
- `local_status_page_authentication_enabled` (Boolean)
38+
- `local_status_page_authentication_password` (String)
39+
- `named_vlans_enabled` (Boolean)
40+
- `remote_status_page_enabled` (Boolean)
41+
- `secure_port_enabled` (Boolean)
42+
3043
### Read-Only
3144

3245
- `id` (String) The id of the object
@@ -36,5 +49,5 @@ resource "meraki_network_settings" "example" {
3649
Import is supported using the following syntax:
3750

3851
```shell
39-
terraform import meraki_network_settings.example "<network_id>,<id>"
52+
terraform import meraki_network_settings.example "<network_id>"
4053
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
data "meraki_network_group_policies" "example" {
2+
id = "L_123456"
3+
network_id = "L_123456"
4+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
data "meraki_network_settings" "example" {
2-
id = "12345678"
2+
id = "L_123456"
33
network_id = "L_123456"
44
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import meraki_network_group_policies.example "<network_id>"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resource "meraki_network_group_policies" "example" {
2+
network_id = "L_123456"
3+
name = "test_group_policy"
4+
bonjour_forwarding_settings = "custom"
5+
bonjour_forwarding_rules = [
6+
{
7+
description = "a simple bonjour rule"
8+
services = ["All Services"]
9+
vlan_id = "2"
10+
}
11+
]
12+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
terraform import meraki_network_settings.example "<network_id>,<id>"
1+
terraform import meraki_network_settings.example "<network_id>"
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
resource "meraki_network_settings" "example" {
2-
network_id = "L_123456"
3-
local_status_page_enabled = false
2+
network_id = "L_123456"
3+
local_status_page_enabled = false
4+
remote_status_page_enabled = false
5+
local_status_page_authentication_enabled = false
6+
local_status_page_authentication_password = "miles123"
7+
named_vlans_enabled = false
8+
secure_port_enabled = false
49
}

gen/definitions/admin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ test_prerequisites: |
6666
resource "meraki_network" "test" {
6767
organization_id = data.meraki_organization.test.id
6868
name = "Network1"
69-
product_types = ["switch"]
69+
product_types = ["switch", "wireless"]
7070
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: Network Group Policies
3+
rest_endpoint: /networks/%v/groupPolicies
4+
doc_category: Networks
5+
id_name: group_policy_id
6+
data_source_name_query: true
7+
attributes:
8+
- tf_name: network_id
9+
type: String
10+
id: true
11+
reference: true
12+
description: Network ID
13+
example: L_123456
14+
test_value: meraki_network.test.id
15+
- model_name: name
16+
type: String
17+
mandatory: true
18+
example: test_group_policy
19+
- model_name: settings
20+
data_path: [bonjourForwarding]
21+
type: String
22+
example: custom
23+
- model_name: rules
24+
data_path: [bonjourForwarding]
25+
type: List
26+
attributes:
27+
- model_name: description
28+
type: String
29+
example: a simple bonjour rule
30+
- model_name: services
31+
type: List
32+
element_type: String
33+
example: All Services
34+
- model_name: vlanId
35+
type: String
36+
example: "2"
37+
38+
39+
40+
41+
42+
test_prerequisites: |
43+
data "meraki_organization" "test" {
44+
name = "Dev"
45+
}
46+
resource "meraki_network" "test" {
47+
organization_id = data.meraki_organization.test.id
48+
name = "Network1"
49+
product_types = ["switch", "wireless"]
50+
}

gen/definitions/networks_settings.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ rest_endpoint: /networks/%v/settings
44
no_delete: true
55
put_create: true
66
doc_category: Networks
7+
id_from_attribute: true
78
attributes:
89
- tf_name: network_id
910
type: String
11+
id: true
1012
reference: true
1113
description: Network ID
1214
example: L_123456
@@ -16,12 +18,34 @@ attributes:
1618
description: asdasdas
1719
example: false
1820
mandatory: true
21+
- model_name: remoteStatusPageEnabled
22+
type: Bool
23+
example: false
24+
- model_name: enabled
25+
data_path: [localStatusPage, authentication]
26+
type: Bool
27+
example: false
28+
- model_name: password
29+
data_path: [localStatusPage, authentication]
30+
type: String
31+
example: miles123
32+
write_only: true
33+
- model_name: enabled
34+
data_path: [namedVlans]
35+
type: Bool
36+
example: false
37+
- model_name: enabled
38+
data_path: [securePort]
39+
type: Bool
40+
example: false
41+
42+
1943
test_prerequisites: |
2044
data "meraki_organization" "test" {
2145
name = "Dev"
2246
}
2347
resource "meraki_network" "test" {
2448
organization_id = data.meraki_organization.test.id
2549
name = "Network1"
26-
product_types = ["switch"]
50+
product_types = ["switch", "wireless"]
2751
}

gen/generator.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ type YamlConfig struct {
111111
Attributes []YamlConfigAttribute `yaml:"attributes"`
112112
TestTags []string `yaml:"test_tags"`
113113
TestPrerequisites string `yaml:"test_prerequisites"`
114+
IdName string `yaml:"id_name"`
114115
}
115116

116117
type YamlConfigAttribute struct {
@@ -177,6 +178,11 @@ func CamelCase(s string) string {
177178
return strings.Join(g, "")
178179
}
179180

181+
func DromedaryCase(s string) string {
182+
s = ToGoName(s)
183+
return strings.ToLower(string(s[0])) + s[1:]
184+
}
185+
180186
// Templating helper function to convert string to snake case
181187
func SnakeCase(s string) string {
182188
var g []string
@@ -345,6 +351,7 @@ func Subtract(a, b int) int {
345351
// Map of templating functions
346352
var functions = template.FuncMap{
347353
"toGoName": ToGoName,
354+
"dromedaryCase": DromedaryCase,
348355
"camelCase": CamelCase,
349356
"snakeCase": SnakeCase,
350357
"sprintf": fmt.Sprintf,
@@ -451,6 +458,9 @@ func NewYamlConfig(bytes []byte) (YamlConfig, error) {
451458
if config.TfName == "" {
452459
config.TfName = strings.Replace(config.Name, " ", "_", -1)
453460
}
461+
if config.IdName == "" {
462+
config.IdName = "id"
463+
}
454464

455465
return config, nil
456466
}

0 commit comments

Comments
 (0)