Skip to content

Commit

Permalink
Add switch port resource and data source and fix doc templates
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Sep 17, 2024
1 parent 2fe290a commit 13f204d
Show file tree
Hide file tree
Showing 58 changed files with 1,721 additions and 46 deletions.
1 change: 0 additions & 1 deletion docs/data-sources/network_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Network Settings` configuration.

```terraform
data "meraki_network_settings" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/network_snmp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Network SNMP` configuration.

```terraform
data "meraki_network_snmp" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/network_syslog_servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Network Syslog Servers` configuration.

```terraform
data "meraki_network_syslog_servers" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/network_vlan_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Network VLAN Profile` configuration.

```terraform
data "meraki_network_vlan_profile" "example" {
id = "Profile1"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/organization_login_security.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Organization Login Security` configuration.

```terraform
data "meraki_organization_login_security" "example" {
id = "123456"
organization_id = "123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_access_control_lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Access Control Lists` configuration.

```terraform
data "meraki_switch_access_control_lists" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_alternate_management_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Alternate Management Interface` configurat

```terraform
data "meraki_switch_alternate_management_interface" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_dhcp_server_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch DHCP Server Policy` configuration.

```terraform
data "meraki_switch_dhcp_server_policy" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_dscp_to_cos_mappings.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch DSCP to CoS mappings` configuration.

```terraform
data "meraki_switch_dscp_to_cos_mappings" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_mtu.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch MTU` configuration.

```terraform
data "meraki_switch_mtu" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
60 changes: 60 additions & 0 deletions docs/data-sources/switch_port.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "meraki_switch_port Data Source - terraform-provider-meraki"
subcategory: "Switches"
description: |-
This data source can read the Switch Port configuration.
---

# meraki_switch_port (Data Source)

This data source can read the `Switch Port` configuration.

## Example Usage

```terraform
data "meraki_switch_port" "example" {
serial = "1234-ABCD-1234"
port_id = "1"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `port_id` (String) Port ID
- `serial` (String) Switch serial

### Read-Only

- `access_policy_number` (Number) The number of a custom access policy to configure on the switch port. Only applicable when `accessPolicyType` is `Custom access policy`.
- `access_policy_type` (String) The type of the access policy of the switch port. Only applicable to access ports. Can be one of `Open`, `Custom access policy`, `MAC allow list` or `Sticky MAC allow list`.
- `adaptive_policy_group_id` (String) The adaptive policy group ID that will be used to tag traffic through this switch port. This ID must pre-exist during the configuration, else needs to be created using adaptivePolicy/groups API. Cannot be applied to a port on a switch bound to profile.
- `allowed_vlans` (String) The VLANs allowed on the switch port. Only applicable to trunk ports.
- `dai_trusted` (Boolean) If true, ARP packets for this port will be considered trusted, and Dynamic ARP Inspection will allow the traffic.
- `dot3az_enabled` (Boolean) The Energy Efficient Ethernet status of the switch port.
- `enabled` (Boolean) The status of the switch port.
- `flexible_stacking_enabled` (Boolean) For supported switches (e.g. MS420/MS425), whether or not the port has flexible stacking enabled.
- `id` (String) The id of the object
- `isolation_enabled` (Boolean) The isolation status of the switch port.
- `link_negotiation` (String) The link speed for the switch port.
- `mac_allow_list` (List of String) Only devices with MAC addresses specified in this list will have access to this port. Up to 20 MAC addresses can be defined. Only applicable when `accessPolicyType` is `MAC allow list`.
- `name` (String) The name of the switch port.
- `peer_sgt_capable` (Boolean) If true, Peer SGT is enabled for traffic through this switch port. Applicable to trunk port only, not access port. Cannot be applied to a port on a switch bound to profile.
- `poe_enabled` (Boolean) The PoE status of the switch port.
- `port_schedule_id` (String) The ID of the port schedule. A value of null will clear the port schedule.
- `profile_enabled` (Boolean) When enabled, override this port`s configuration with a port profile.
- `profile_id` (String) When enabled, the ID of the port profile used to override the port`s configuration.
- `profile_iname` (String) When enabled, the IName of the profile.
- `rstp_enabled` (Boolean) The rapid spanning tree protocol status.
- `sticky_mac_allow_list` (List of String) The initial list of MAC addresses for sticky Mac allow list. Only applicable when `accessPolicyType` is `Sticky MAC allow list`.
- `sticky_mac_allow_list_limit` (Number) The maximum number of MAC addresses for sticky MAC allow list. Only applicable when `accessPolicyType` is `Sticky MAC allow list`.
- `storm_control_enabled` (Boolean) The storm control status of the switch port.
- `stp_guard` (String) The state of the STP guard (`disabled`, `root guard`, `bpdu guard` or `loop guard`).
- `tags` (List of String) The list of tags of the switch port.
- `type` (String) The type of the switch port (`trunk`, `access` or `stack`).
- `udld` (String) The action to take when Unidirectional Link is detected (Alert only, Enforce). Default configuration is Alert only.
- `vlan` (Number) The VLAN of the switch port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports.
- `voice_vlan` (Number) The voice VLAN of the switch port. Only applicable to access ports.
1 change: 0 additions & 1 deletion docs/data-sources/switch_qos_rule_order.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch QoS Rule Order` configuration.

```terraform
data "meraki_switch_qos_rule_order" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_routing_interface_dhcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Routing Interface DHCP` configuration.

```terraform
data "meraki_switch_routing_interface_dhcp" "example" {
id = "1234"
serial = "1234-ABCD-1234"
interface_id = "1234"
}
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_routing_multicast.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Routing Multicast` configuration.

```terraform
data "meraki_switch_routing_multicast" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_routing_ospf.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Routing OSPF` configuration.

```terraform
data "meraki_switch_routing_ospf" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Settings` configuration.

```terraform
data "meraki_switch_settings" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_stack_routing_interface_dhcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Stack Routing Interface DHCP` configuratio

```terraform
data "meraki_switch_stack_routing_interface_dhcp" "example" {
id = "1234"
network_id = "L_123456"
switch_stack_id = "1234"
interface_id = "1234"
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_storm_control.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Storm Control` configuration.

```terraform
data "meraki_switch_storm_control" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_stp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch STP` configuration.

```terraform
data "meraki_switch_stp" "example" {
id = "L_123456"
network_id = "L_123456"
}
```
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/switch_warm_spare.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ This data source can read the `Switch Warm Spare` configuration.

```terraform
data "meraki_switch_warm_spare" "example" {
id = "1234-ABCD-1234"
serial = "1234-ABCD-1234"
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/network_vlan_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ Optional:
Import is supported using the following syntax:

```shell
terraform import meraki_network_vlan_profile.example "<iname>"
terraform import meraki_network_vlan_profile.example "<network_id>,<iname>"
```
103 changes: 103 additions & 0 deletions docs/resources/switch_port.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "meraki_switch_port Resource - terraform-provider-meraki"
subcategory: "Switches"
description: |-
This resource can manage the Switch Port configuration.
---

# meraki_switch_port (Resource)

This resource can manage the `Switch Port` configuration.

## Example Usage

```terraform
resource "meraki_switch_port" "example" {
serial = "1234-ABCD-1234"
port_id = "1"
access_policy_number = 2
access_policy_type = "Sticky MAC allow list"
adaptive_policy_group_id = "123"
allowed_vlans = "1,3,5-10"
dai_trusted = false
enabled = true
flexible_stacking_enabled = true
isolation_enabled = false
link_negotiation = "Auto negotiate"
name = "My switch port"
peer_sgt_capable = false
poe_enabled = true
port_schedule_id = "1234"
rstp_enabled = true
sticky_mac_allow_list_limit = 5
storm_control_enabled = true
stp_guard = "disabled"
type = "access"
udld = "Alert only"
vlan = 10
voice_vlan = 20
dot3az_enabled = false
profile_enabled = false
profile_id = "1284392014819"
profile_iname = "iname"
mac_allow_list = ["34:56:fe:ce:8e:a0"]
sticky_mac_allow_list = ["34:56:fe:ce:8e:b0"]
tags = ["tag1"]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `port_id` (String) Port ID
- `serial` (String) Switch serial

### Optional

- `access_policy_number` (Number) The number of a custom access policy to configure on the switch port. Only applicable when `accessPolicyType` is `Custom access policy`.
- `access_policy_type` (String) The type of the access policy of the switch port. Only applicable to access ports. Can be one of `Open`, `Custom access policy`, `MAC allow list` or `Sticky MAC allow list`.
- Choices: `Custom access policy`, `MAC allow list`, `Open`, `Sticky MAC allow list`
- `adaptive_policy_group_id` (String) The adaptive policy group ID that will be used to tag traffic through this switch port. This ID must pre-exist during the configuration, else needs to be created using adaptivePolicy/groups API. Cannot be applied to a port on a switch bound to profile.
- `allowed_vlans` (String) The VLANs allowed on the switch port. Only applicable to trunk ports.
- `dai_trusted` (Boolean) If true, ARP packets for this port will be considered trusted, and Dynamic ARP Inspection will allow the traffic.
- `dot3az_enabled` (Boolean) The Energy Efficient Ethernet status of the switch port.
- `enabled` (Boolean) The status of the switch port.
- `flexible_stacking_enabled` (Boolean) For supported switches (e.g. MS420/MS425), whether or not the port has flexible stacking enabled.
- `isolation_enabled` (Boolean) The isolation status of the switch port.
- `link_negotiation` (String) The link speed for the switch port.
- `mac_allow_list` (List of String) Only devices with MAC addresses specified in this list will have access to this port. Up to 20 MAC addresses can be defined. Only applicable when `accessPolicyType` is `MAC allow list`.
- `name` (String) The name of the switch port.
- `peer_sgt_capable` (Boolean) If true, Peer SGT is enabled for traffic through this switch port. Applicable to trunk port only, not access port. Cannot be applied to a port on a switch bound to profile.
- `poe_enabled` (Boolean) The PoE status of the switch port.
- `port_schedule_id` (String) The ID of the port schedule. A value of null will clear the port schedule.
- `profile_enabled` (Boolean) When enabled, override this port`s configuration with a port profile.
- `profile_id` (String) When enabled, the ID of the port profile used to override the port`s configuration.
- `profile_iname` (String) When enabled, the IName of the profile.
- `rstp_enabled` (Boolean) The rapid spanning tree protocol status.
- `sticky_mac_allow_list` (List of String) The initial list of MAC addresses for sticky Mac allow list. Only applicable when `accessPolicyType` is `Sticky MAC allow list`.
- `sticky_mac_allow_list_limit` (Number) The maximum number of MAC addresses for sticky MAC allow list. Only applicable when `accessPolicyType` is `Sticky MAC allow list`.
- `storm_control_enabled` (Boolean) The storm control status of the switch port.
- `stp_guard` (String) The state of the STP guard (`disabled`, `root guard`, `bpdu guard` or `loop guard`).
- Choices: `bpdu guard`, `disabled`, `loop guard`, `root guard`
- `tags` (List of String) The list of tags of the switch port.
- `type` (String) The type of the switch port (`trunk`, `access` or `stack`).
- Choices: `access`, `stack`, `trunk`
- `udld` (String) The action to take when Unidirectional Link is detected (Alert only, Enforce). Default configuration is Alert only.
- Choices: `Alert only`, `Enforce`
- `vlan` (Number) The VLAN of the switch port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports.
- `voice_vlan` (Number) The voice VLAN of the switch port. Only applicable to access ports.

### Read-Only

- `id` (String) The id of the object

## Import

Import is supported using the following syntax:

```shell
terraform import meraki_switch_port.example "<serial>,<port_id>"
```
2 changes: 1 addition & 1 deletion docs/resources/switch_routing_interface_dhcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ Optional:
Import is supported using the following syntax:

```shell
terraform import meraki_switch_routing_interface_dhcp.example "<interface_id>"
terraform import meraki_switch_routing_interface_dhcp.example "<serial>,<interface_id>"
```
2 changes: 1 addition & 1 deletion docs/resources/switch_stack_routing_interface_dhcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ Optional:
Import is supported using the following syntax:

```shell
terraform import meraki_switch_stack_routing_interface_dhcp.example "<interface_id>"
terraform import meraki_switch_stack_routing_interface_dhcp.example "<network_id>,<switch_stack_id>,<interface_id>"
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_network_settings" "example" {
id = "L_123456"
network_id = "L_123456"
}
1 change: 0 additions & 1 deletion examples/data-sources/meraki_network_snmp/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_network_snmp" "example" {
id = "L_123456"
network_id = "L_123456"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_network_syslog_servers" "example" {
id = "L_123456"
network_id = "L_123456"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_network_vlan_profile" "example" {
id = "Profile1"
network_id = "L_123456"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_organization_login_security" "example" {
id = "123456"
organization_id = "123456"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_switch_access_control_lists" "example" {
id = "L_123456"
network_id = "L_123456"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_switch_alternate_management_interface" "example" {
id = "L_123456"
network_id = "L_123456"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_switch_dhcp_server_policy" "example" {
id = "L_123456"
network_id = "L_123456"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_switch_dscp_to_cos_mappings" "example" {
id = "L_123456"
network_id = "L_123456"
}
1 change: 0 additions & 1 deletion examples/data-sources/meraki_switch_mtu/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_switch_mtu" "example" {
id = "L_123456"
network_id = "L_123456"
}
4 changes: 4 additions & 0 deletions examples/data-sources/meraki_switch_port/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "meraki_switch_port" "example" {
serial = "1234-ABCD-1234"
port_id = "1"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data "meraki_switch_qos_rule_order" "example" {
id = "L_123456"
network_id = "L_123456"
}
Loading

0 comments on commit 13f204d

Please sign in to comment.