Skip to content

Commit

Permalink
- meraki_networks_switch_stacks_routing_interfaces - additional value…
Browse files Browse the repository at this point in the history
…s in the API request #97

- networks_switch_dhcp_server_policy_arp_inspection_trusted_servers - inconsistency #96
  • Loading branch information
fmunozmiranda committed Jul 10, 2024
1 parent 1f15178 commit dcb4179
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import meraki_networks_switch_dhcp_server_policy_arp_inspection_trusted_servers.example "network_id"
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

terraform {
required_providers {
meraki = {
version = "0.2.5-alpha"
source = "hashicorp.com/edu/meraki"
# "hashicorp.com/edu/meraki" is the local built source, change to "cisco-en-programmability/meraki" to use downloaded version from registry
}
}
}

provider "meraki" {
meraki_debug = "true"
}

resource "meraki_networks_switch_dhcp_server_policy_arp_inspection_trusted_servers" "example" {

ipv4 = {

address = "1.2.3.4"
}
mac = "00:11:22:33:44:55"
network_id = "L_828099381482771185"
vlan = 100
}

output "meraki_networks_switch_dhcp_server_policy_arp_inspection_trusted_servers_example" {
value = meraki_networks_switch_dhcp_server_policy_arp_inspection_trusted_servers.example
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import meraki_networks_switch_stacks.example "network_id,switch_stack_id"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
terraform {
required_providers {
meraki = {
version = "0.2.5-alpha"
source = "hashicorp.com/edu/meraki"
# "hashicorp.com/edu/meraki" is the local built source, change to "cisco-en-programmability/meraki" to use downloaded version from registry
}
}
}

provider "meraki" {
meraki_debug = "true"
}


resource "meraki_networks_switch_stacks" "example" {

name = "A cool stack"
network_id = "N_828099381482850157"
serials = ["QBSB-AX45-LY9A", "QBSB-BNH2-KDXJ"]
}

output "meraki_networks_switch_stacks_example" {
value = meraki_networks_switch_stacks.example
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
terraform {
required_providers {
meraki = {
version = "0.2.5-alpha"
source = "hashicorp.com/edu/meraki"
# "hashicorp.com/edu/meraki" is the local built source, change to "cisco-en-programmability/meraki" to use downloaded version from registry
}
}
}

provider "meraki" {
meraki_debug = "true"
}

resource "meraki_networks_switch_stacks_routing_interfaces" "example" {

default_gateway = "192.168.1.1"
interface_ip = "192.168.1.2"
ipv6 = {

address = "1:2:3:4::1"
assignment_mode = "static"
gateway = "1:2:3:4::2"
prefix = "1:2:3:4::/48"
}
multicast_routing = "disabled"
name = "L3 interface"
network_id = "L_828099381482775374"
ospf_settings = {

area = "0"
cost = 1
is_passive_enabled = true
}
subnet = "192.168.1.0/24"
switch_stack_id = "string"
vlan_id = 100
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ provider "meraki" {

resource "meraki_networks_vlan_profiles" "vlan_profiles" {
network_id = "L_828099381482771185"
iname = "Default"
name = "Default Profile"
iname = "Default 2"
name = "Default Profile 2"
vlan_names = [ {
name = "default",
name = "default_2",
vlan_id = "1"
}, {
name = "test",
name = "test_2",
vlan_id = "2"
}]
vlan_groups = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ func ResponseSwitchGetNetworkSwitchDhcpServerPolicyArpInspectionTrustedServersIt
}
return types.Int64{}
}(),
NetworkID: state.NetworkID,
}
state = itemState
return state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func (r *NetworksSwitchStacksRoutingInterfacesResource) Schema(_ context.Context
stringplanmodifier.UseStateForUnknown(),
},
},
"default_gateway_response": schema.StringAttribute{
MarkdownDescription: `IPv4 default gateway`,
Computed: true,
},
"interface_id": schema.StringAttribute{
MarkdownDescription: `The id`,
Computed: true,
Expand Down Expand Up @@ -497,18 +501,19 @@ func (r *NetworksSwitchStacksRoutingInterfacesResource) Delete(ctx context.Conte

// TF Structs Schema
type NetworksSwitchStacksRoutingInterfacesRs struct {
NetworkID types.String `tfsdk:"network_id"`
SwitchStackID types.String `tfsdk:"switch_stack_id"`
InterfaceID types.String `tfsdk:"interface_id"`
DefaultGateway types.String `tfsdk:"default_gateway"`
InterfaceIP types.String `tfsdk:"interface_ip"`
IPv6 *ResponseSwitchGetNetworkSwitchStackRoutingInterfaceIpv6Rs `tfsdk:"ipv6"`
MulticastRouting types.String `tfsdk:"multicast_routing"`
Name types.String `tfsdk:"name"`
OspfSettings *ResponseSwitchGetNetworkSwitchStackRoutingInterfaceOspfSettingsRs `tfsdk:"ospf_settings"`
OspfV3 *ResponseSwitchGetNetworkSwitchStackRoutingInterfaceOspfV3Rs `tfsdk:"ospf_v3"`
Subnet types.String `tfsdk:"subnet"`
VLANID types.Int64 `tfsdk:"vlan_id"`
NetworkID types.String `tfsdk:"network_id"`
SwitchStackID types.String `tfsdk:"switch_stack_id"`
InterfaceID types.String `tfsdk:"interface_id"`
DefaultGateway types.String `tfsdk:"default_gateway"`
DefaultGatewayResponse types.String `tfsdk:"default_gateway_response"`
InterfaceIP types.String `tfsdk:"interface_ip"`
IPv6 *ResponseSwitchGetNetworkSwitchStackRoutingInterfaceIpv6Rs `tfsdk:"ipv6"`
MulticastRouting types.String `tfsdk:"multicast_routing"`
Name types.String `tfsdk:"name"`
OspfSettings *ResponseSwitchGetNetworkSwitchStackRoutingInterfaceOspfSettingsRs `tfsdk:"ospf_settings"`
OspfV3 *ResponseSwitchGetNetworkSwitchStackRoutingInterfaceOspfV3Rs `tfsdk:"ospf_v3"`
Subnet types.String `tfsdk:"subnet"`
VLANID types.Int64 `tfsdk:"vlan_id"`
}

type ResponseSwitchGetNetworkSwitchStackRoutingInterfaceIpv6Rs struct {
Expand Down Expand Up @@ -539,6 +544,7 @@ func (r *NetworksSwitchStacksRoutingInterfacesRs) toSdkApiRequestCreate(ctx cont
} else {
defaultGateway = &emptyString
}

interfaceIP := new(string)
if !r.InterfaceIP.IsUnknown() && !r.InterfaceIP.IsNull() {
*interfaceIP = r.InterfaceIP.ValueString()
Expand Down Expand Up @@ -623,6 +629,9 @@ func (r *NetworksSwitchStacksRoutingInterfacesRs) toSdkApiRequestUpdate(ctx cont
} else {
defaultGateway = &emptyString
}
if !r.DefaultGatewayResponse.IsNull() && !r.DefaultGatewayResponse.Equal(types.StringValue("")) {
defaultGateway = &emptyString
}
interfaceIP := new(string)
if !r.InterfaceIP.IsUnknown() && !r.InterfaceIP.IsNull() {
*interfaceIP = r.InterfaceIP.ValueString()
Expand Down Expand Up @@ -703,9 +712,10 @@ func (r *NetworksSwitchStacksRoutingInterfacesRs) toSdkApiRequestUpdate(ctx cont
// From gosdk to TF Structs Schema
func ResponseSwitchGetNetworkSwitchStackRoutingInterfaceItemToBodyRs(state NetworksSwitchStacksRoutingInterfacesRs, response *merakigosdk.ResponseSwitchGetNetworkSwitchStackRoutingInterface, is_read bool) NetworksSwitchStacksRoutingInterfacesRs {
itemState := NetworksSwitchStacksRoutingInterfacesRs{
DefaultGateway: types.StringValue(response.DefaultGateway),
InterfaceID: types.StringValue(response.InterfaceID),
InterfaceIP: types.StringValue(response.InterfaceIP),
DefaultGateway: types.StringValue(response.DefaultGateway),
DefaultGatewayResponse: types.StringValue(response.DefaultGateway),
InterfaceID: types.StringValue(response.InterfaceID),
InterfaceIP: types.StringValue(response.InterfaceIP),
IPv6: func() *ResponseSwitchGetNetworkSwitchStackRoutingInterfaceIpv6Rs {
if response.IPv6 != nil {
return &ResponseSwitchGetNetworkSwitchStackRoutingInterfaceIpv6Rs{
Expand Down

0 comments on commit dcb4179

Please sign in to comment.