diff --git a/examples/samples/resources/meraki_networks_appliance_traffic_shaping_rules/resource.tf b/examples/samples/resources/meraki_networks_appliance_traffic_shaping_rules/resource.tf index a2bf53f..a1274a6 100644 --- a/examples/samples/resources/meraki_networks_appliance_traffic_shaping_rules/resource.tf +++ b/examples/samples/resources/meraki_networks_appliance_traffic_shaping_rules/resource.tf @@ -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 } @@ -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 } \ No newline at end of file diff --git a/internal/provider/resource_meraki_networks_appliance_traffic_shaping_rules.go b/internal/provider/resource_meraki_networks_appliance_traffic_shaping_rules.go index ed44b68..d7f1bda 100644 --- a/internal/provider/resource_meraki_networks_appliance_traffic_shaping_rules.go +++ b/internal/provider/resource_meraki_networks_appliance_traffic_shaping_rules.go @@ -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" @@ -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{