Skip to content

Commit

Permalink
Merge pull request #102 from jeremmfr/bugfix-1.12.1
Browse files Browse the repository at this point in the history
Release v1.12.2
  • Loading branch information
jeremmfr authored Feb 3, 2021
2 parents 1179eb3 + 28c9427 commit 43d906e
Show file tree
Hide file tree
Showing 44 changed files with 87 additions and 83 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions junos/func_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_aggregate_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_application_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions junos/resource_bgp_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions junos/resource_bgp_neighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions junos/resource_firewall_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_firewall_policer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions junos/resource_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
},
},
}
Expand Down
12 changes: 6 additions & 6 deletions junos/resource_interface_logical.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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),
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_ospf_area.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_policyoptions_as_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions junos/resource_policyoptions_as_path_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_policyoptions_community.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions junos/resource_policyoptions_policy_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_policyoptions_prefix_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_rib_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_routing_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions junos/resource_security_ike_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_security_ike_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_security_ike_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_security_ipsec_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_security_ipsec_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions junos/resource_security_ipsec_vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -86,7 +86,7 @@ func resourceIpsecVpn() *schema.Resource {
"identity_service": {
Type: schema.TypeString,
Optional: true,
ValidateDiagFunc: validateNameObjectJunos([]string{}),
ValidateDiagFunc: validateNameObjectJunos([]string{}, 64),
},
},
},
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 43d906e

Please sign in to comment.