Skip to content

Commit

Permalink
appliance_traffic_shaping_rules does not store order #173
Browse files Browse the repository at this point in the history
Changing to list to preserve the order
  • Loading branch information
fmunozmiranda committed Nov 19, 2024
1 parent b1708e5 commit da83b20
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,47 @@ provider "meraki" {


resource "meraki_networks_appliance_traffic_shaping_rules" "example" {

default_rules_enabled = true
network_id = "L_828099381482775486"

rules = [{

definitions = [{

type = "host"
value = "google.com"
definitions = [
{
type = "host"
value = "google2.com"
},
{
type = "applicationCategory"
value_obj = {
id = "meraki:layer7/category/8"
name = "Peer-to-peer (P2P)"
},

}]
# dscp_tag_value = 1
}
}
]
per_client_bandwidth_limits = {
bandwidth_limits = {
limit_down = 1000000
limit_up = 1000000
}
settings = "custom"
}
priority = "high"
}, {
definitions = [
{
type = "host"
value = "spain2.com"
},
{
type = "applicationCategory"
value_obj = {
id = "meraki:layer7/category/8"
name = "Peer-to-peer (P2P)"
}
}
]
per_client_bandwidth_limits = {

bandwidth_limits = {

limit_down = 1000000
limit_up = 1000000
}
Expand All @@ -47,6 +65,7 @@ resource "meraki_networks_appliance_traffic_shaping_rules" "example" {
}]
}


output "meraki_networks_appliance_traffic_shaping_rules_example" {
value = meraki_networks_appliance_traffic_shaping_rules.example
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/setdefault"
Expand Down Expand Up @@ -63,26 +64,26 @@ func (r *NetworksApplianceTrafficShapingRulesResource) Schema(_ context.Context,
MarkdownDescription: `networkId path parameter. Network ID`,
Required: true,
},
"rules": schema.SetNestedAttribute{
"rules": schema.ListNestedAttribute{
MarkdownDescription: ` An array of traffic shaping rules. Rules are applied in the order that
they are specified in. An empty list (or null) means no rules. Note that
you are allowed a maximum of 8 rules.
`,
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.Set{
setplanmodifier.UseStateForUnknown(),
PlanModifiers: []planmodifier.List{
listplanmodifier.UseStateForUnknown(),
},
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{

"definitions": schema.SetNestedAttribute{
"definitions": schema.ListNestedAttribute{
MarkdownDescription: ` A list of objects describing the definitions of your traffic shaping rule. At least one definition is required.
`,
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.Set{
setplanmodifier.UseStateForUnknown(),
PlanModifiers: []planmodifier.List{
listplanmodifier.UseStateForUnknown(),
},
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
Expand Down

0 comments on commit da83b20

Please sign in to comment.