Skip to content

Commit 9b71805

Browse files
authored
Add support for policy groups (#490)
1 parent 627c46c commit 9b71805

File tree

15 files changed

+1886
-0
lines changed

15 files changed

+1886
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `preferred_color_group_list_id`
66
- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_traffic_data_policy_definition` resource to `preferred_color_group_list_id`
77
- Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478)
8+
- Add `sdwan_policy_group` resource and data source
89

910
## 0.6.2
1011

docs/data-sources/policy_group.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "sdwan_policy_group Data Source - terraform-provider-sdwan"
4+
subcategory: "Policy Groups"
5+
description: |-
6+
This data source can read the Policy Group .
7+
---
8+
9+
# sdwan_policy_group (Data Source)
10+
11+
This data source can read the Policy Group .
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "sdwan_policy_group" "example" {
17+
id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
18+
}
19+
```
20+
21+
<!-- schema generated by tfplugindocs -->
22+
## Schema
23+
24+
### Required
25+
26+
- `id` (String) The id of the object
27+
28+
### Read-Only
29+
30+
- `description` (String) Description
31+
- `devices` (Attributes List) List of devices (see [below for nested schema](#nestedatt--devices))
32+
- `feature_profile_ids` (Set of String) List of feature profile IDs
33+
- `name` (String) The name of the policy group
34+
- `policy_versions` (List of String) List of all associated policy versions
35+
- `solution` (String) Type of solution
36+
37+
<a id="nestedatt--devices"></a>
38+
### Nested Schema for `devices`
39+
40+
Read-Only:
41+
42+
- `deploy` (Boolean) Deploy to device if enabled.
43+
- `id` (String) Device ID
44+
- `variables` (Attributes Set) List of variables (see [below for nested schema](#nestedatt--devices--variables))
45+
46+
<a id="nestedatt--devices--variables"></a>
47+
### Nested Schema for `devices.variables`
48+
49+
Read-Only:
50+
51+
- `list_value` (List of String) Use this instead of `value` in case value is of type `List`.
52+
- `name` (String) Variable name
53+
- `value` (String) Variable value

docs/guides/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ description: |-
1414
- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `preferred_color_group_list_id`
1515
- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_traffic_data_policy_definition` resource to `preferred_color_group_list_id`
1616
- Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478)
17+
- Add `sdwan_policy_group` resource and data source
1718

1819
## 0.6.2
1920

docs/resources/policy_group.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "sdwan_policy_group Resource - terraform-provider-sdwan"
4+
subcategory: "Policy Groups"
5+
description: |-
6+
This resource can manage a Policy Group .
7+
Minimum SD-WAN Manager version: 20.12.0
8+
---
9+
10+
# sdwan_policy_group (Resource)
11+
12+
This resource can manage a Policy Group .
13+
- Minimum SD-WAN Manager version: `20.12.0`
14+
15+
## Example Usage
16+
17+
```terraform
18+
resource "sdwan_policy_group" "example" {
19+
name = "PG_1"
20+
description = "My policy group 1"
21+
solution = "sdwan"
22+
feature_profile_ids = ["f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"]
23+
devices = [
24+
{
25+
id = "C8K-40C0CCFD-9EA8-2B2E-E73B-32C5924EC79B"
26+
}
27+
]
28+
}
29+
```
30+
31+
<!-- schema generated by tfplugindocs -->
32+
## Schema
33+
34+
### Required
35+
36+
- `description` (String) Description
37+
- `name` (String) The name of the policy group
38+
- `solution` (String) Type of solution
39+
- Choices: `sdwan`
40+
41+
### Optional
42+
43+
- `devices` (Attributes List) List of devices (see [below for nested schema](#nestedatt--devices))
44+
- `feature_profile_ids` (Set of String) List of feature profile IDs
45+
- `policy_versions` (List of String) List of all associated policy versions
46+
47+
### Read-Only
48+
49+
- `id` (String) The id of the object
50+
51+
<a id="nestedatt--devices"></a>
52+
### Nested Schema for `devices`
53+
54+
Optional:
55+
56+
- `deploy` (Boolean) Deploy to device if enabled.
57+
- Default value: `false`
58+
- `id` (String) Device ID
59+
- `variables` (Attributes Set) List of variables (see [below for nested schema](#nestedatt--devices--variables))
60+
61+
<a id="nestedatt--devices--variables"></a>
62+
### Nested Schema for `devices.variables`
63+
64+
Required:
65+
66+
- `name` (String) Variable name
67+
68+
Optional:
69+
70+
- `list_value` (List of String) Use this instead of `value` in case value is of type `List`.
71+
- `value` (String) Variable value
72+
73+
## Import
74+
75+
Import is supported using the following syntax:
76+
77+
The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:
78+
79+
```shell
80+
terraform import sdwan_policy_group.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
81+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "sdwan_policy_group" "example" {
2+
id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import sdwan_policy_group.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
resource "sdwan_policy_group" "example" {
2+
name = "PG_1"
3+
description = "My policy group 1"
4+
solution = "sdwan"
5+
feature_profile_ids = ["f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"]
6+
devices = [
7+
{
8+
id = "C8K-40C0CCFD-9EA8-2B2E-E73B-32C5924EC79B"
9+
}
10+
]
11+
}
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
---
2+
name: Policy Group
3+
rest_endpoint: /v1/policy-group/
4+
id_attribute: id
5+
minimum_version: 20.12.0
6+
test_tags: [SDWAN_2012]
7+
doc_category: Policy Groups
8+
attributes:
9+
- model_name: name
10+
type: String
11+
mandatory: true
12+
description: The name of the policy group
13+
example: PG_1
14+
- model_name: description
15+
type: String
16+
mandatory: true
17+
description: Description
18+
example: My policy group 1
19+
- model_name: solution
20+
type: String
21+
mandatory: true
22+
enum_values: [sdwan]
23+
description: Type of solution
24+
example: sdwan
25+
- model_name: profiles
26+
tf_name: feature_profile_ids
27+
type: Set
28+
element_type: String
29+
description: List of feature profile IDs
30+
example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
31+
test_value: "[sdwan_application_priority_feature_profile.test.id]"
32+
- model_name: devices
33+
type: List
34+
description: List of devices
35+
attributes:
36+
- model_name: id
37+
type: String
38+
id: true
39+
description: Device ID
40+
example: C8K-40C0CCFD-9EA8-2B2E-E73B-32C5924EC79B
41+
- tf_name: deploy
42+
tf_only: true
43+
type: Bool
44+
description: Deploy to device if enabled.
45+
default_value: false
46+
example: true
47+
- model_name: variables
48+
type: Set
49+
description: List of variables
50+
exclude_test: true
51+
attributes:
52+
- model_name: name
53+
type: String
54+
mandatory: true
55+
id: true
56+
description: Variable name
57+
example: qos_interfaces
58+
- model_name: value
59+
type: String
60+
description: Variable value
61+
example: GigabitEthernet1
62+
- model_name: list_value
63+
type: List
64+
element_type: String
65+
tf_only: true
66+
description: Use this instead of `value` in case value is of type `List`.
67+
example: GigabitEthernet1
68+
- tf_name: policy_versions
69+
tf_only: true
70+
type: Versions
71+
description: List of all associated policy versions
72+
exclude_test: true
73+
74+
test_prerequisites: |
75+
resource "sdwan_system_feature_profile" "test" {
76+
name = "SYSTEM_TF"
77+
description = "Terraform test"
78+
}
79+
80+
resource "sdwan_system_basic_feature" "test" {
81+
name = "BASIC_TF"
82+
feature_profile_id = sdwan_system_feature_profile.test.id
83+
}
84+
85+
resource "sdwan_system_aaa_feature" "test" {
86+
name = "AAA_TF"
87+
feature_profile_id = sdwan_system_feature_profile.test.id
88+
server_auth_order = ["local"]
89+
users = [{
90+
name = "admin"
91+
password = "admin"
92+
}]
93+
}
94+
95+
resource "sdwan_system_bfd_feature" "test" {
96+
name = "BFD_TF"
97+
feature_profile_id = sdwan_system_feature_profile.test.id
98+
}
99+
100+
resource "sdwan_system_global_feature" "test" {
101+
name = "GLOBAL_TF"
102+
feature_profile_id = sdwan_system_feature_profile.test.id
103+
}
104+
105+
resource "sdwan_system_logging_feature" "test" {
106+
name = "LOGGING_TF"
107+
feature_profile_id = sdwan_system_feature_profile.test.id
108+
}
109+
110+
resource "sdwan_system_omp_feature" "test" {
111+
name = "OMP_TF"
112+
feature_profile_id = sdwan_system_feature_profile.test.id
113+
}
114+
115+
resource "sdwan_transport_feature_profile" "test" {
116+
name = "TRANSPORT_TF"
117+
description = "My transport feature profile 1"
118+
}
119+
120+
resource "sdwan_transport_wan_vpn_feature" "test" {
121+
name = "WAN_VPN_TF"
122+
feature_profile_id = sdwan_transport_feature_profile.test.id
123+
vpn = 0
124+
}
125+
126+
resource "sdwan_transport_wan_vpn_interface_ethernet_feature" "test" {
127+
name = "WAN_VPN_INT_TF"
128+
feature_profile_id = sdwan_transport_feature_profile.test.id
129+
transport_wan_vpn_feature_id = sdwan_transport_wan_vpn_feature.test.id
130+
interface_name = "GigabitEthernet1"
131+
shutdown = false
132+
ipv4_configuration_type = "dynamic"
133+
ipv4_dhcp_distance = 1
134+
tunnel_interface = true
135+
tunnel_interface_encapsulations = [
136+
{
137+
encapsulation = "ipsec"
138+
}
139+
]
140+
}
141+
142+
resource "sdwan_configuration_group" "test" {
143+
name = "CG_1"
144+
description = "My config group 1"
145+
solution = "sdwan"
146+
feature_profile_ids = [
147+
sdwan_system_feature_profile.test.id,
148+
sdwan_transport_feature_profile.test.id,
149+
]
150+
devices = [{
151+
id = "C8K-40C0CCFD-9EA8-2B2E-E73B-32C5924EC79B"
152+
deploy = true
153+
variables = [
154+
{
155+
name = "host_name"
156+
value = "edge1"
157+
},
158+
{
159+
name = "pseudo_commit_timer"
160+
value = 0
161+
},
162+
{
163+
name = "site_id"
164+
value = 1
165+
},
166+
{
167+
name = "system_ip"
168+
value = "10.1.1.1"
169+
},
170+
{
171+
name = "ipv6_strict_control"
172+
value = "false"
173+
}
174+
]
175+
}]
176+
feature_versions = [
177+
sdwan_system_basic_feature.test.version,
178+
sdwan_system_aaa_feature.test.version,
179+
sdwan_system_bfd_feature.test.version,
180+
sdwan_system_global_feature.test.version,
181+
sdwan_system_logging_feature.test.version,
182+
sdwan_system_omp_feature.test.version,
183+
sdwan_transport_wan_vpn_interface_ethernet_feature.test.version,
184+
]
185+
}
186+
187+
resource "sdwan_application_priority_feature_profile" "test" {
188+
name = "APPLICATION_PRIORITY_TF"
189+
description = "Terraform test"
190+
}
191+
192+
resource "sdwan_application_priority_qos_policy" "test" {
193+
name = "qos"
194+
description = "QoS policy for application priority"
195+
feature_profile_id = sdwan_application_priority_feature_profile.test.id
196+
target_interface_variable = "{{qos_interfaces}}"
197+
}

0 commit comments

Comments
 (0)