Skip to content

Commit b104f50

Browse files
add support for auto_generated_vlan_name in catalystcenter_anycast_gatewy resource
1 parent 19c8b8b commit b104f50

File tree

10 files changed

+15
-17
lines changed

10 files changed

+15
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 0.1.19 (unreleased)
22

3+
- Add support for auto_generated_vlan_name in `catalystcenter_anycast_gateway` resource
34
- Fix issue with tags removal from templates in `catalystcenter_assign_templates_to_tag` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/165)
45

56
## 0.1.18

docs/guides/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ description: |-
99

1010
## 0.1.19 (unreleased)
1111

12+
- Add support for auto_generated_vlan_name in `catalystcenter_anycast_gateway` resource
1213
- Fix issue with tags removal from templates in `catalystcenter_assign_templates_to_tag` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/165)
1314

1415
## 0.1.18

docs/resources/anycast_gateway.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ resource "catalystcenter_anycast_gateway" "example" {
2727
ip_directed_broadcast = false
2828
intra_subnet_routing_enabled = false
2929
multiple_ip_to_mac_addresses = false
30+
auto_generate_vlan_name = false
3031
}
3132
```
3233

@@ -35,16 +36,15 @@ resource "catalystcenter_anycast_gateway" "example" {
3536

3637
### Required
3738

39+
- `auto_generate_vlan_name` (Boolean) This field cannot be true when vlanName is provided. the vlanName will be generated as ipPoolGroupV4Cidr-virtualNetworkName for non-critical VLANs. for critical VLANs with DATA trafficType, vlanName will be CRITICAL_VLAN. for critical VLANs with VOICE trafficType, vlanName will be VOICE_VLAN
3840
- `fabric_id` (String) ID of the fabric to contain this anycast gateway
3941
- `ip_pool_name` (String) Name of the IP pool associated with the anycast gateway
4042
- `traffic_type` (String) The type of traffic the anycast gateway serves
4143
- Choices: `DATA`, `VOICE`
4244
- `virtual_network_name` (String) Name of the layer 3 virtual network associated with the anycast gateway. the virtual network must have already been added to the site before creating an anycast gateway with it
43-
- `vlan_name` (String) Name of the VLAN of the anycast gateway
4445

4546
### Optional
4647

47-
- `auto_generate_vlan_name` (Boolean) This field cannot be true when vlanName is provided. the vlanName will be generated as ipPoolGroupV4Cidr-virtualNetworkName for non-critical VLANs. for critical VLANs with DATA trafficType, vlanName will be CRITICAL_VLAN. for critical VLANs with VOICE trafficType, vlanName will be VOICE_VLAN
4848
- `critical_pool` (Boolean) Enable/disable critical VLAN. if true, autoGenerateVlanName must also be true. (isCriticalPool is not applicable to INFRA_VN)
4949
- `intra_subnet_routing_enabled` (Boolean) Enable/disable Intra-Subnet Routing (not applicable to INFRA_VN)
5050
- `ip_directed_broadcast` (Boolean) Enable/disable IP-directed broadcast (not applicable to INFRA_VN)
@@ -57,6 +57,7 @@ resource "catalystcenter_anycast_gateway" "example" {
5757
- `tcp_mss_adjustment` (Number) TCP maximum segment size adjustment
5858
- Range: `500`-`1440`
5959
- `vlan_id` (Number) ID of the VLAN of the anycast gateway. allowed VLAN range is 2-4093 except for reserved VLANs 1002-1005, 2046, and 4094. if deploying an anycast gateway on a fabric zone, this vlanId must match the vlanId of the corresponding anycast gateway on the fabric site
60+
- `vlan_name` (String) Name of the VLAN of the anycast gateway
6061
- `wireless_pool` (Boolean) Enable/disable fabric-enabled wireless (not applicable to INFRA_VN)
6162

6263
### Read-Only

examples/resources/catalystcenter_anycast_gateway/resource.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ resource "catalystcenter_anycast_gateway" "example" {
1212
ip_directed_broadcast = false
1313
intra_subnet_routing_enabled = false
1414
multiple_ip_to_mac_addresses = false
15+
auto_generate_vlan_name = false
1516
}

gen/definitions/anycast_gateway.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ attributes:
5656
response_data_path: response.0.vlanName
5757
type: String
5858
description: Name of the VLAN of the anycast gateway
59-
mandatory: true
6059
example: VLAN401
6160
- model_name: vlanId
6261
requires_replace: true
@@ -141,8 +140,10 @@ attributes:
141140
data_path: '0'
142141
response_data_path: response.0.autoGenerateVlanName
143142
type: Bool
143+
mandatory: true
144+
write_only: true
144145
description: 'This field cannot be true when vlanName is provided. the vlanName will be generated as ipPoolGroupV4Cidr-virtualNetworkName for non-critical VLANs. for critical VLANs with DATA trafficType, vlanName will be CRITICAL_VLAN. for critical VLANs with VOICE trafficType, vlanName will be VOICE_VLAN'
145-
exclude_test: true
146+
example: false
146147
test_prerequisites: |
147148
resource "catalystcenter_area" "test" {
148149
name = "Area1"

internal/provider/data_source_catalystcenter_anycast_gateway_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func testAccDataSourceCcAnycastGatewayConfig() string {
108108
config += ` ip_directed_broadcast = false` + "\n"
109109
config += ` intra_subnet_routing_enabled = false` + "\n"
110110
config += ` multiple_ip_to_mac_addresses = false` + "\n"
111+
config += ` auto_generate_vlan_name = false` + "\n"
111112
config += `}` + "\n"
112113

113114
config += `

internal/provider/model_catalystcenter_anycast_gateway.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,6 @@ func (data *AnycastGateway) fromBody(ctx context.Context, res gjson.Result) {
216216
} else {
217217
data.SupplicantBasedExtendedNodeOnboarding = types.BoolNull()
218218
}
219-
if value := res.Get("response.0.autoGenerateVlanName"); value.Exists() {
220-
data.AutoGenerateVlanName = types.BoolValue(value.Bool())
221-
} else {
222-
data.AutoGenerateVlanName = types.BoolNull()
223-
}
224219
}
225220

226221
// End of section. //template:end fromBody
@@ -307,11 +302,6 @@ func (data *AnycastGateway) updateFromBody(ctx context.Context, res gjson.Result
307302
} else {
308303
data.SupplicantBasedExtendedNodeOnboarding = types.BoolNull()
309304
}
310-
if value := res.Get("response.0.autoGenerateVlanName"); value.Exists() && !data.AutoGenerateVlanName.IsNull() {
311-
data.AutoGenerateVlanName = types.BoolValue(value.Bool())
312-
} else {
313-
data.AutoGenerateVlanName = types.BoolNull()
314-
}
315305
}
316306

317307
// End of section. //template:end updateFromBody

internal/provider/resource_catalystcenter_anycast_gateway.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (r *AnycastGatewayResource) Schema(ctx context.Context, req resource.Schema
103103
},
104104
"vlan_name": schema.StringAttribute{
105105
MarkdownDescription: helpers.NewAttributeDescription("Name of the VLAN of the anycast gateway").String,
106-
Required: true,
106+
Optional: true,
107107
PlanModifiers: []planmodifier.String{
108108
stringplanmodifier.RequiresReplace(),
109109
},
@@ -169,7 +169,7 @@ func (r *AnycastGatewayResource) Schema(ctx context.Context, req resource.Schema
169169
},
170170
"auto_generate_vlan_name": schema.BoolAttribute{
171171
MarkdownDescription: helpers.NewAttributeDescription("This field cannot be true when vlanName is provided. the vlanName will be generated as ipPoolGroupV4Cidr-virtualNetworkName for non-critical VLANs. for critical VLANs with DATA trafficType, vlanName will be CRITICAL_VLAN. for critical VLANs with VOICE trafficType, vlanName will be VOICE_VLAN").String,
172-
Optional: true,
172+
Required: true,
173173
},
174174
},
175175
}

internal/provider/resource_catalystcenter_anycast_gateway_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ func testAccCcAnycastGatewayConfig_minimum() string {
100100
config += ` fabric_id = catalystcenter_fabric_site.test.id` + "\n"
101101
config += ` virtual_network_name = catalystcenter_virtual_network_to_fabric_site.test.virtual_network_name` + "\n"
102102
config += ` ip_pool_name = catalystcenter_ip_pool_reservation.test.name` + "\n"
103-
config += ` vlan_name = "VLAN401"` + "\n"
104103
config += ` traffic_type = "DATA"` + "\n"
104+
config += ` auto_generate_vlan_name = false` + "\n"
105105
config += `}` + "\n"
106106
return config
107107
}
@@ -124,6 +124,7 @@ func testAccCcAnycastGatewayConfig_all() string {
124124
config += ` ip_directed_broadcast = false` + "\n"
125125
config += ` intra_subnet_routing_enabled = false` + "\n"
126126
config += ` multiple_ip_to_mac_addresses = false` + "\n"
127+
config += ` auto_generate_vlan_name = false` + "\n"
127128
config += `}` + "\n"
128129
return config
129130
}

templates/guides/changelog.md.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ description: |-
99

1010
## 0.1.19 (unreleased)
1111

12+
- Add support for auto_generated_vlan_name in `catalystcenter_anycast_gateway` resource
1213
- Fix issue with tags removal from templates in `catalystcenter_assign_templates_to_tag` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/165)
1314

1415
## 0.1.18

0 commit comments

Comments
 (0)