From 0c56f130e6a025929b817323476566763f73c5ed Mon Sep 17 00:00:00 2001 From: Jeremy Muriel Date: Wed, 3 Feb 2021 09:17:49 +0100 Subject: [PATCH 1/2] Fix #101: allow the name length of some objects > 32 for part of the resources --- junos/func_common.go | 4 ++-- junos/resource_aggregate_route.go | 2 +- junos/resource_application.go | 2 +- junos/resource_application_set.go | 2 +- junos/resource_bgp_group.go | 4 ++-- junos/resource_bgp_neighbor.go | 4 ++-- junos/resource_firewall_filter.go | 8 ++++---- junos/resource_firewall_policer.go | 2 +- junos/resource_interface.go | 12 ++++++------ junos/resource_interface_logical.go | 12 ++++++------ junos/resource_ospf_area.go | 2 +- junos/resource_policyoptions_as_path.go | 2 +- junos/resource_policyoptions_as_path_group.go | 4 ++-- junos/resource_policyoptions_community.go | 2 +- junos/resource_policyoptions_policy_statement.go | 4 ++-- junos/resource_policyoptions_prefix_list.go | 2 +- junos/resource_rib_group.go | 2 +- junos/resource_routing_instance.go | 2 +- junos/resource_security_ike_gateway.go | 4 ++-- junos/resource_security_ike_policy.go | 2 +- junos/resource_security_ike_proposal.go | 2 +- junos/resource_security_ipsec_policy.go | 2 +- junos/resource_security_ipsec_proposal.go | 2 +- junos/resource_security_ipsec_vpn.go | 8 ++++---- junos/resource_security_log_stream.go | 2 +- junos/resource_security_nat_destination.go | 6 +++--- junos/resource_security_nat_destination_pool.go | 4 ++-- junos/resource_security_nat_source.go | 6 +++--- junos/resource_security_nat_source_pool.go | 4 ++-- junos/resource_security_nat_static.go | 6 +++--- junos/resource_security_policy.go | 6 +++--- junos/resource_security_policy_tunnel_pair_policy.go | 8 ++++---- junos/resource_security_utm_custom_url_pattern.go | 2 +- ...ity_utm_profile_web_filtering_juniper_enhanced.go | 2 +- junos/resource_security_zone.go | 6 +++--- junos/resource_static_route.go | 2 +- junos/resource_system_login_class.go | 2 +- junos/resource_system_login_user.go | 2 +- junos/resource_system_ntp_server.go | 2 +- junos/resource_system_radius_server.go | 2 +- junos/resource_system_syslog_file.go | 2 +- junos/resource_system_syslog_host.go | 2 +- junos/resource_vlan.go | 8 ++++---- 43 files changed, 83 insertions(+), 83 deletions(-) diff --git a/junos/func_common.go b/junos/func_common.go index d24f37dd..9b2733e6 100644 --- a/junos/func_common.go +++ b/junos/func_common.go @@ -80,11 +80,11 @@ func validateCIDRNetwork(network string) error { return nil } -func validateNameObjectJunos(exclude []string) schema.SchemaValidateDiagFunc { +func validateNameObjectJunos(exclude []string, length int) schema.SchemaValidateDiagFunc { return func(i interface{}, path cty.Path) diag.Diagnostics { var diags diag.Diagnostics v := i.(string) - if strings.Count(v, "") > 32 { + if strings.Count(v, "") > length { diags = append(diags, diag.Diagnostic{ Severity: diag.Error, Summary: fmt.Sprintf("%s invalid name (too long)", i), diff --git a/junos/resource_aggregate_route.go b/junos/resource_aggregate_route.go index f6c0076a..b7d7124e 100644 --- a/junos/resource_aggregate_route.go +++ b/junos/resource_aggregate_route.go @@ -46,7 +46,7 @@ func resourceAggregateRoute() *schema.Resource { Optional: true, ForceNew: true, Default: defaultWord, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "active": { Type: schema.TypeBool, diff --git a/junos/resource_application.go b/junos/resource_application.go index bb4cb7cd..48c3a0df 100644 --- a/junos/resource_application.go +++ b/junos/resource_application.go @@ -30,7 +30,7 @@ func resourceApplication() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "protocol": { Type: schema.TypeString, diff --git a/junos/resource_application_set.go b/junos/resource_application_set.go index a2ad09ed..805a73ce 100644 --- a/junos/resource_application_set.go +++ b/junos/resource_application_set.go @@ -28,7 +28,7 @@ func resourceApplicationSet() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "applications": { Type: schema.TypeList, diff --git a/junos/resource_bgp_group.go b/junos/resource_bgp_group.go index 9f8c05b0..0ff75817 100644 --- a/junos/resource_bgp_group.go +++ b/junos/resource_bgp_group.go @@ -24,14 +24,14 @@ func resourceBgpGroup() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "routing_instance": { Type: schema.TypeString, Optional: true, ForceNew: true, Default: defaultWord, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "type": { Type: schema.TypeString, diff --git a/junos/resource_bgp_neighbor.go b/junos/resource_bgp_neighbor.go index 1332986b..385f836c 100644 --- a/junos/resource_bgp_neighbor.go +++ b/junos/resource_bgp_neighbor.go @@ -31,13 +31,13 @@ func resourceBgpNeighbor() *schema.Resource { Optional: true, ForceNew: true, Default: defaultWord, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "group": { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "accept_remote_nexthop": { Type: schema.TypeBool, diff --git a/junos/resource_firewall_filter.go b/junos/resource_firewall_filter.go index fbf19507..2a97982a 100644 --- a/junos/resource_firewall_filter.go +++ b/junos/resource_firewall_filter.go @@ -31,7 +31,7 @@ func resourceFirewallFilter() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "family": { Type: schema.TypeString, @@ -52,12 +52,12 @@ func resourceFirewallFilter() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "filter": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "from": { Type: schema.TypeList, @@ -236,7 +236,7 @@ func resourceFirewallFilter() *schema.Resource { "policer": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "log": { Type: schema.TypeBool, diff --git a/junos/resource_firewall_policer.go b/junos/resource_firewall_policer.go index c8b2f460..8017c81c 100644 --- a/junos/resource_firewall_policer.go +++ b/junos/resource_firewall_policer.go @@ -32,7 +32,7 @@ func resourceFirewallPolicer() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "filter_specific": { Type: schema.TypeBool, diff --git a/junos/resource_interface.go b/junos/resource_interface.go index fc454b39..b130ff2e 100644 --- a/junos/resource_interface.go +++ b/junos/resource_interface.go @@ -322,22 +322,22 @@ func resourceInterface() *schema.Resource { "inet_filter_input": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "inet_filter_output": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "inet6_filter_input": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "inet6_filter_output": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "inet_rpf_check": { Type: schema.TypeList, @@ -418,12 +418,12 @@ func resourceInterface() *schema.Resource { "security_zone": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "routing_instance": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, }, } diff --git a/junos/resource_interface_logical.go b/junos/resource_interface_logical.go index 410d317c..3fc2d270 100644 --- a/junos/resource_interface_logical.go +++ b/junos/resource_interface_logical.go @@ -184,12 +184,12 @@ func resourceInterfaceLogical() *schema.Resource { "filter_input": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "filter_output": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "rpf_check": { Type: schema.TypeList, @@ -331,12 +331,12 @@ func resourceInterfaceLogical() *schema.Resource { "filter_input": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "filter_output": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "rpf_check": { Type: schema.TypeList, @@ -361,12 +361,12 @@ func resourceInterfaceLogical() *schema.Resource { "security_zone": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "routing_instance": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, }, } diff --git a/junos/resource_ospf_area.go b/junos/resource_ospf_area.go index f58be699..1f6d0630 100644 --- a/junos/resource_ospf_area.go +++ b/junos/resource_ospf_area.go @@ -38,7 +38,7 @@ func resourceOspfArea() *schema.Resource { Optional: true, ForceNew: true, Default: defaultWord, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "version": { Type: schema.TypeString, diff --git a/junos/resource_policyoptions_as_path.go b/junos/resource_policyoptions_as_path.go index 46a9394f..662e6c11 100644 --- a/junos/resource_policyoptions_as_path.go +++ b/junos/resource_policyoptions_as_path.go @@ -29,7 +29,7 @@ func resourcePolicyoptionsAsPath() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "path": { Type: schema.TypeString, diff --git a/junos/resource_policyoptions_as_path_group.go b/junos/resource_policyoptions_as_path_group.go index 39f847a3..e2774906 100644 --- a/junos/resource_policyoptions_as_path_group.go +++ b/junos/resource_policyoptions_as_path_group.go @@ -29,7 +29,7 @@ func resourcePolicyoptionsAsPathGroup() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "as_path": { Type: schema.TypeList, @@ -39,7 +39,7 @@ func resourcePolicyoptionsAsPathGroup() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "path": { Type: schema.TypeString, diff --git a/junos/resource_policyoptions_community.go b/junos/resource_policyoptions_community.go index 3ce92df7..e1bc7548 100644 --- a/junos/resource_policyoptions_community.go +++ b/junos/resource_policyoptions_community.go @@ -29,7 +29,7 @@ func resourcePolicyoptionsCommunity() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "members": { Type: schema.TypeList, diff --git a/junos/resource_policyoptions_policy_statement.go b/junos/resource_policyoptions_policy_statement.go index fb8ea0c9..93d55a2c 100644 --- a/junos/resource_policyoptions_policy_statement.go +++ b/junos/resource_policyoptions_policy_statement.go @@ -33,7 +33,7 @@ func resourcePolicyoptionsPolicyStatement() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "from": { Type: schema.TypeList, @@ -356,7 +356,7 @@ func resourcePolicyoptionsPolicyStatement() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "from": { Type: schema.TypeList, diff --git a/junos/resource_policyoptions_prefix_list.go b/junos/resource_policyoptions_prefix_list.go index df8c2e90..ef62f32e 100644 --- a/junos/resource_policyoptions_prefix_list.go +++ b/junos/resource_policyoptions_prefix_list.go @@ -30,7 +30,7 @@ func resourcePolicyoptionsPrefixList() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "prefix": { Type: schema.TypeList, diff --git a/junos/resource_rib_group.go b/junos/resource_rib_group.go index adaea8ab..cba94384 100644 --- a/junos/resource_rib_group.go +++ b/junos/resource_rib_group.go @@ -30,7 +30,7 @@ func resourceRibGroup() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "import_policy": { Type: schema.TypeList, diff --git a/junos/resource_routing_instance.go b/junos/resource_routing_instance.go index 238c1877..7eb5c5d2 100644 --- a/junos/resource_routing_instance.go +++ b/junos/resource_routing_instance.go @@ -29,7 +29,7 @@ func resourceRoutingInstance() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{"default"}), + ValidateDiagFunc: validateNameObjectJunos([]string{"default"}, 64), }, "type": { Type: schema.TypeString, diff --git a/junos/resource_security_ike_gateway.go b/junos/resource_security_ike_gateway.go index 84d7a2d0..87b83a41 100644 --- a/junos/resource_security_ike_gateway.go +++ b/junos/resource_security_ike_gateway.go @@ -42,7 +42,7 @@ func resourceIkeGateway() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "address": { Type: schema.TypeList, @@ -241,7 +241,7 @@ func resourceIkeGateway() *schema.Resource { "access_profile": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), ConflictsWith: []string{ "aaa.0.client_username", "aaa.0.client_password", diff --git a/junos/resource_security_ike_policy.go b/junos/resource_security_ike_policy.go index 63ccef3f..86616570 100644 --- a/junos/resource_security_ike_policy.go +++ b/junos/resource_security_ike_policy.go @@ -46,7 +46,7 @@ func resourceIkePolicy() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "proposals": { Type: schema.TypeList, diff --git a/junos/resource_security_ike_proposal.go b/junos/resource_security_ike_proposal.go index 7d2bbf22..3c3b6285 100644 --- a/junos/resource_security_ike_proposal.go +++ b/junos/resource_security_ike_proposal.go @@ -34,7 +34,7 @@ func resourceIkeProposal() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "authentication_algorithm": { Type: schema.TypeString, diff --git a/junos/resource_security_ipsec_policy.go b/junos/resource_security_ipsec_policy.go index 00d3d37b..17369227 100644 --- a/junos/resource_security_ipsec_policy.go +++ b/junos/resource_security_ipsec_policy.go @@ -31,7 +31,7 @@ func resourceIpsecPolicy() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "proposals": { Type: schema.TypeList, diff --git a/junos/resource_security_ipsec_proposal.go b/junos/resource_security_ipsec_proposal.go index 47136ccd..2d0e148c 100644 --- a/junos/resource_security_ipsec_proposal.go +++ b/junos/resource_security_ipsec_proposal.go @@ -34,7 +34,7 @@ func resourceIpsecProposal() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "authentication_algorithm": { Type: schema.TypeString, diff --git a/junos/resource_security_ipsec_vpn.go b/junos/resource_security_ipsec_vpn.go index 512e0f63..7d6a32b1 100644 --- a/junos/resource_security_ipsec_vpn.go +++ b/junos/resource_security_ipsec_vpn.go @@ -35,7 +35,7 @@ func resourceIpsecVpn() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "establish_tunnels": { Type: schema.TypeString, @@ -71,7 +71,7 @@ func resourceIpsecVpn() *schema.Resource { "policy": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "identity_local": { Type: schema.TypeString, @@ -86,7 +86,7 @@ func resourceIpsecVpn() *schema.Resource { "identity_service": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, }, }, @@ -127,7 +127,7 @@ func resourceIpsecVpn() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "local_ip": { Type: schema.TypeString, diff --git a/junos/resource_security_log_stream.go b/junos/resource_security_log_stream.go index cb82bf04..77604c02 100644 --- a/junos/resource_security_log_stream.go +++ b/junos/resource_security_log_stream.go @@ -102,7 +102,7 @@ func resourceSecurityLogStream() *schema.Resource { "routing_instance": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{"default"}), + ValidateDiagFunc: validateNameObjectJunos([]string{"default"}, 64), }, }, }, diff --git a/junos/resource_security_nat_destination.go b/junos/resource_security_nat_destination.go index 5d7bb541..e8c64419 100644 --- a/junos/resource_security_nat_destination.go +++ b/junos/resource_security_nat_destination.go @@ -30,7 +30,7 @@ func resourceSecurityNatDestination() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "from": { Type: schema.TypeList, @@ -60,7 +60,7 @@ func resourceSecurityNatDestination() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "destination_address": { Type: schema.TypeString, @@ -81,7 +81,7 @@ func resourceSecurityNatDestination() *schema.Resource { "pool": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, }, }, diff --git a/junos/resource_security_nat_destination_pool.go b/junos/resource_security_nat_destination_pool.go index 2d2bbd26..e442a198 100644 --- a/junos/resource_security_nat_destination_pool.go +++ b/junos/resource_security_nat_destination_pool.go @@ -33,7 +33,7 @@ func resourceSecurityNatDestinationPool() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "address": { Type: schema.TypeString, @@ -55,7 +55,7 @@ func resourceSecurityNatDestinationPool() *schema.Resource { "routing_instance": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, }, } diff --git a/junos/resource_security_nat_source.go b/junos/resource_security_nat_source.go index c14d1395..bf84d21d 100644 --- a/junos/resource_security_nat_source.go +++ b/junos/resource_security_nat_source.go @@ -31,7 +31,7 @@ func resourceSecurityNatSource() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "from": { Type: schema.TypeList, @@ -81,7 +81,7 @@ func resourceSecurityNatSource() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "match": { Type: schema.TypeList, @@ -121,7 +121,7 @@ func resourceSecurityNatSource() *schema.Resource { "pool": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, }, }, diff --git a/junos/resource_security_nat_source_pool.go b/junos/resource_security_nat_source_pool.go index 61bdc279..ef18989f 100644 --- a/junos/resource_security_nat_source_pool.go +++ b/junos/resource_security_nat_source_pool.go @@ -35,7 +35,7 @@ func resourceSecurityNatSourcePool() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "address": { Type: schema.TypeList, @@ -46,7 +46,7 @@ func resourceSecurityNatSourcePool() *schema.Resource { "routing_instance": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "port_no_translation": { Type: schema.TypeBool, diff --git a/junos/resource_security_nat_static.go b/junos/resource_security_nat_static.go index cee59212..fdb699ee 100644 --- a/junos/resource_security_nat_static.go +++ b/junos/resource_security_nat_static.go @@ -30,7 +30,7 @@ func resourceSecurityNatStatic() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "from": { Type: schema.TypeList, @@ -59,7 +59,7 @@ func resourceSecurityNatStatic() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "destination_address": { Type: schema.TypeString, @@ -80,7 +80,7 @@ func resourceSecurityNatStatic() *schema.Resource { "routing_instance": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "prefix": { Type: schema.TypeString, diff --git a/junos/resource_security_policy.go b/junos/resource_security_policy.go index 639e294e..4d55351f 100644 --- a/junos/resource_security_policy.go +++ b/junos/resource_security_policy.go @@ -30,13 +30,13 @@ func resourceSecurityPolicy() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "to_zone": { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "policy": { Type: schema.TypeList, @@ -46,7 +46,7 @@ func resourceSecurityPolicy() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "match_source_address": { Type: schema.TypeList, diff --git a/junos/resource_security_policy_tunnel_pair_policy.go b/junos/resource_security_policy_tunnel_pair_policy.go index f2033d89..175d65cd 100644 --- a/junos/resource_security_policy_tunnel_pair_policy.go +++ b/junos/resource_security_policy_tunnel_pair_policy.go @@ -29,25 +29,25 @@ func resourceSecurityPolicyTunnelPairPolicy() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "zone_b": { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "policy_a_to_b": { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "policy_b_to_a": { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, }, } diff --git a/junos/resource_security_utm_custom_url_pattern.go b/junos/resource_security_utm_custom_url_pattern.go index 5c30ea7b..21f80b6c 100644 --- a/junos/resource_security_utm_custom_url_pattern.go +++ b/junos/resource_security_utm_custom_url_pattern.go @@ -28,7 +28,7 @@ func resourceSecurityUtmCustomURLPattern() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "value": { Type: schema.TypeList, diff --git a/junos/resource_security_utm_profile_web_filtering_juniper_enhanced.go b/junos/resource_security_utm_profile_web_filtering_juniper_enhanced.go index f2a575f1..f4ecac22 100644 --- a/junos/resource_security_utm_profile_web_filtering_juniper_enhanced.go +++ b/junos/resource_security_utm_profile_web_filtering_juniper_enhanced.go @@ -65,7 +65,7 @@ func resourceSecurityUtmProfileWebFilteringEnhanced() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 128), }, "action": { Type: schema.TypeString, diff --git a/junos/resource_security_zone.go b/junos/resource_security_zone.go index 43623594..d72870ea 100644 --- a/junos/resource_security_zone.go +++ b/junos/resource_security_zone.go @@ -32,7 +32,7 @@ func resourceSecurityZone() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "inbound_services": { Type: schema.TypeList, @@ -52,7 +52,7 @@ func resourceSecurityZone() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "network": { Type: schema.TypeString, @@ -70,7 +70,7 @@ func resourceSecurityZone() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "address": { Type: schema.TypeList, diff --git a/junos/resource_static_route.go b/junos/resource_static_route.go index fe9cdb45..41cdda13 100644 --- a/junos/resource_static_route.go +++ b/junos/resource_static_route.go @@ -56,7 +56,7 @@ func resourceStaticRoute() *schema.Resource { Optional: true, ForceNew: true, Default: defaultWord, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "preference": { Type: schema.TypeInt, diff --git a/junos/resource_system_login_class.go b/junos/resource_system_login_class.go index eee1d5ff..2610c54f 100644 --- a/junos/resource_system_login_class.go +++ b/junos/resource_system_login_class.go @@ -54,7 +54,7 @@ func resourceSystemLoginClass() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "access_end": { Type: schema.TypeString, diff --git a/junos/resource_system_login_user.go b/junos/resource_system_login_user.go index 0a670874..83b38033 100644 --- a/junos/resource_system_login_user.go +++ b/junos/resource_system_login_user.go @@ -35,7 +35,7 @@ func resourceSystemLoginUser() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "class": { Type: schema.TypeString, diff --git a/junos/resource_system_ntp_server.go b/junos/resource_system_ntp_server.go index 58424ac8..407adcd2 100644 --- a/junos/resource_system_ntp_server.go +++ b/junos/resource_system_ntp_server.go @@ -47,7 +47,7 @@ func resourceSystemNtpServer() *schema.Resource { "routing_instance": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "version": { Type: schema.TypeInt, diff --git a/junos/resource_system_radius_server.go b/junos/resource_system_radius_server.go index 017d9544..f97f0af9 100644 --- a/junos/resource_system_radius_server.go +++ b/junos/resource_system_radius_server.go @@ -111,7 +111,7 @@ func resourceSystemRadiusServer() *schema.Resource { "routing_instance": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, }, } diff --git a/junos/resource_system_syslog_file.go b/junos/resource_system_syslog_file.go index 1ecaf009..50d71c4b 100644 --- a/junos/resource_system_syslog_file.go +++ b/junos/resource_system_syslog_file.go @@ -51,7 +51,7 @@ func resourceSystemSyslogFile() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "allow_duplicates": { Type: schema.TypeBool, diff --git a/junos/resource_system_syslog_host.go b/junos/resource_system_syslog_host.go index b9f274c4..dcc95790 100644 --- a/junos/resource_system_syslog_host.go +++ b/junos/resource_system_syslog_host.go @@ -76,7 +76,7 @@ func resourceSystemSyslogHost() *schema.Resource { "log_prefix": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 32), }, "match": { Type: schema.TypeString, diff --git a/junos/resource_vlan.go b/junos/resource_vlan.go index 59ee41bc..6e92cecc 100644 --- a/junos/resource_vlan.go +++ b/junos/resource_vlan.go @@ -41,7 +41,7 @@ func resourceVlan() *schema.Resource { Type: schema.TypeString, ForceNew: true, Required: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "description": { Type: schema.TypeString, @@ -80,17 +80,17 @@ func resourceVlan() *schema.Resource { "forward_filter_input": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "forward_filter_output": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "forward_flood_input": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: validateNameObjectJunos([]string{}), + ValidateDiagFunc: validateNameObjectJunos([]string{}, 64), }, "private_vlan": { Type: schema.TypeString, From 28c94276185e2f4ce75417683ecdd5d615700dc5 Mon Sep 17 00:00:00 2001 From: Jeremy Muriel Date: Wed, 3 Feb 2021 09:21:53 +0100 Subject: [PATCH 2/2] Release v1.12.2 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9252d6b9..13b0eb11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ ENHANCEMENTS: BUG FIXES: +## 1.12.2 (February 3, 2021) +BUG FIXES: +* allow the name length of some objects > 32 for part of the resources (Fixes [#101](https://github.com/jeremmfr/terraform-provider-junos/issues/101)) + ## 1.12.1 (February 1, 2021) BUG FIXES: * possible mismatch for routing_instance in junos_interface_logical resource (Fixes #98)