Skip to content

Commit

Permalink
Add the VRF helper
Browse files Browse the repository at this point in the history
  • Loading branch information
vaerh committed Jul 12, 2023
1 parent ebf45d9 commit c595bcb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
7 changes: 7 additions & 0 deletions routeros/provider_schema_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
KeyName = "name"
KeyPlaceBefore = "place_before"
KeyRunning = "running"
KeyVrf = "vrf"
)

// PropResourcePath Resource path property.
Expand Down Expand Up @@ -190,6 +191,12 @@ var (
Type: schema.TypeBool,
Computed: true,
}
PropVrfRw = &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "main",
Description: "The VRF table this resource operates on.",
}
)

// PropMtuRw MTU value can be integer or 'auto'.
Expand Down
7 changes: 1 addition & 6 deletions routeros/resource_bgp_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,7 @@ func ResourceRoutingBGPConnection() *schema.Resource {
Optional: true,
Description: "Whether to use the BFD protocol for faster connection state detection.",
},
"vrf": {
Type: schema.TypeString,
Optional: true,
Default: "main",
Description: "Name of the VRF BGP connections operates on. By default always use the 'main' routing table.",
},
KeyVrf: PropVrfRw,
}

return &schema.Resource{
Expand Down
7 changes: 1 addition & 6 deletions routeros/resource_bgp_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,7 @@ func ResourceRoutingBGPTemplate() *schema.Resource {
Optional: true,
Description: "Whether to use the BFD protocol for faster connection state detection.",
},
"vrf": {
Type: schema.TypeString,
Optional: true,
Default: "main",
Description: "Name of the VRF BGP connections operates on. By default always use the 'main' routing table.",
},
KeyVrf: PropVrfRw,
}

return &schema.Resource{
Expand Down
7 changes: 1 addition & 6 deletions routeros/resource_ip_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@ func ResourceIpService() *schema.Resource {
Description: "Specifies which TLS versions to allow by a particular service.",
ValidateFunc: validation.StringInSlice([]string{"any", "only-1.2"}, false),
},
"vrf": {
Type: schema.TypeString,
Optional: true,
Default: "main",
Description: "Specify which VRF instance to use by a particular service.",
},
KeyVrf: PropVrfRw,
}

resCreateUpdate := func(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
Expand Down
7 changes: 1 addition & 6 deletions routeros/resource_routing_ospf_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@ func ResourceRoutingOspfInstance() *schema.Resource {
Description: "OSPF version this instance will be running (v2 for IPv4, v3 for IPv6).",
ValidateFunc: validation.IntBetween(2, 3),
},
"vrf": {
Type: schema.TypeString,
Optional: true,
Default: "main",
Description: "The VRF table this OSPF instance operates on",
},
KeyVrf: PropVrfRw,
}

return &schema.Resource{
Expand Down

0 comments on commit c595bcb

Please sign in to comment.