Skip to content

Commit

Permalink
Merge pull request #407 from jeremmfr/main
Browse files Browse the repository at this point in the history
Release v1.29.0
  • Loading branch information
jeremmfr authored Jul 13, 2022
2 parents 10f76a8 + 066278b commit fe4a7cd
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Set up Go 1.18
uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.18.4
check-latest: true
id: go
- name: Show version
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ ENHANCEMENTS:

BUG FIXES:

## 1.29.0 (July 13, 2022)

ENHANCEMENTS:

* resource/`junos_routing_instance`: add `router_id` argument (Fixes [#405](https://github.com/jeremmfr/terraform-provider-junos/issues/405))

## 1.28.0 (May 30, 2022)

FEATURES:
Expand Down
2 changes: 2 additions & 0 deletions docs/data-sources/routing_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ The following attributes are exported:
List of interfaces in routing-instance.
- **route_distinguisher** (String)
Route distinguisher for this instance.
- **router_id** (String)
Router identifier.
- **vrf_export** (List of String)
Export policy for VRF instance RIBs.
- **vrf_import** (List of String)
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/routing_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ The following arguments are supported:
Import policy for instance RIBs
- **route_distinguisher** (Optional, String)
Route distinguisher for this instance.
- **router_id** (Optional, String)
Router identifier.
- **vrf_export** (Optional, List of String)
Export policy for VRF instance RIBs.
- **vrf_import** (Optional, List of String)
Expand Down
7 changes: 7 additions & 0 deletions junos/data_source_routing_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func dataSourceRoutingInstance() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"router_id": {
Type: schema.TypeString,
Computed: true,
},
"vrf_export": {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -126,6 +130,9 @@ func fillRoutingInstanceDataSource(d *schema.ResourceData, instanceOptions insta
if tfErr := d.Set("route_distinguisher", instanceOptions.routeDistinguisher); tfErr != nil {
panic(tfErr)
}
if tfErr := d.Set("router_id", instanceOptions.routerID); tfErr != nil {
panic(tfErr)
}
if tfErr := d.Set("type", instanceOptions.instanceType); tfErr != nil {
panic(tfErr)
}
Expand Down
15 changes: 15 additions & 0 deletions junos/resource_routing_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type instanceOptions struct {
instanceType string
name string
routeDistinguisher string
routerID string
vrfTarget string
vrfTargetExport string
vrfTargetImport string
Expand Down Expand Up @@ -99,6 +100,11 @@ func resourceRoutingInstance() *schema.Resource {
ValidateFunc: validation.StringMatch(regexp.MustCompile(
`^(\d|\.)+L?:\d+$`), "must have valid route distinguisher. Use format 'x:y'"),
},
"router_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsIPv4Address,
},
"vrf_export": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -394,6 +400,9 @@ func setRoutingInstance(d *schema.ResourceData, clt *Client, junSess *junosSessi
if v := d.Get("as").(string); v != "" {
configSet = append(configSet, setPrefix+"routing-options autonomous-system "+v)
}
if v := d.Get("router_id").(string); v != "" {
configSet = append(configSet, setPrefix+"routing-options router-id "+v)
}
if v := d.Get("description").(string); v != "" {
configSet = append(configSet, setPrefix+"description \""+v+"\"")
}
Expand Down Expand Up @@ -442,6 +451,8 @@ func readRoutingInstance(instance string, clt *Client, junSess *junosSession) (i
case strings.HasPrefix(itemTrim, "routing-options instance-import "):
confRead.instanceImport = append(confRead.instanceImport,
strings.TrimPrefix(itemTrim, "routing-options instance-import "))
case strings.HasPrefix(itemTrim, "routing-options router-id "):
confRead.routerID = strings.TrimPrefix(itemTrim, "routing-options router-id ")
case strings.HasPrefix(itemTrim, "vrf-export "):
confRead.vrfExport = append(confRead.vrfExport, strings.Trim(strings.TrimPrefix(itemTrim, "vrf-export "), "\""))
case strings.HasPrefix(itemTrim, "vrf-import "):
Expand Down Expand Up @@ -474,6 +485,7 @@ func delRoutingInstanceOpts(d *schema.ResourceData, clt *Client, junSess *junosS
setPrefix+"routing-options autonomous-system",
setPrefix+"routing-options instance-export",
setPrefix+"routing-options instance-import",
setPrefix+"routing-options router-id",
setPrefix+"vtep-source-interface",
)
if !d.Get("configure_type_singly").(bool) {
Expand Down Expand Up @@ -514,6 +526,9 @@ func fillRoutingInstanceData(d *schema.ResourceData, instanceOptions instanceOpt
if tfErr := d.Set("instance_import", instanceOptions.instanceImport); tfErr != nil {
panic(tfErr)
}
if tfErr := d.Set("router_id", instanceOptions.routerID); tfErr != nil {
panic(tfErr)
}
if tfErr := d.Set("vtep_source_interface", instanceOptions.vtepSourceIf); tfErr != nil {
panic(tfErr)
}
Expand Down
2 changes: 2 additions & 0 deletions junos/resource_routing_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ resource "junos_routing_instance" "testacc_routingInst" {
description = "testacc routingInst"
instance_export = [junos_policyoptions_policy_statement.testacc_routingInst2.name]
instance_import = [junos_policyoptions_policy_statement.testacc_routingInst2.name]
router_id = "192.0.2.65"
}
resource "junos_policyoptions_community" "testacc_routingInst2" {
name = "testacc_routingInst2"
Expand Down Expand Up @@ -148,6 +149,7 @@ resource "junos_routing_instance" "testacc_routingInst" {
description = "testacc routingInst"
instance_export = [junos_policyoptions_policy_statement.testacc_routingInst2.name]
instance_import = [junos_policyoptions_policy_statement.testacc_routingInst2.name]
router_id = "192.0.2.65"
}
resource "junos_policyoptions_community" "testacc_routingInst2" {
name = "testacc_routingInst2"
Expand Down

0 comments on commit fe4a7cd

Please sign in to comment.