Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Source: azurerm_route_table: Added support for: disable_bgp_route_propagation #21940

Merged
merged 5 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions internal/services/network/route_table_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
Expand Down Expand Up @@ -35,6 +36,11 @@ func dataSourceRouteTable() *pluginsdk.Resource {

"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"bgp_route_propagation_enabled": {
Type: pluginsdk.TypeBool,
Computed: true,
},

"location": commonschema.LocationComputed(),

"route": {
Expand Down Expand Up @@ -109,11 +115,13 @@ func dataSourceRouteTableRead(d *pluginsdk.ResourceData, meta interface{}) error
if err := d.Set("subnets", flattenRouteTableDataSourceSubnets(props.Subnets)); err != nil {
return err
}
}

if err := d.Set("bgp_route_propagation_enabled", !pointer.From(props.DisableBgpRoutePropagation)); err != nil {
return err
}
}
return tags.FlattenAndSet(d, model.Tags)
}

return nil
}

Expand Down
7 changes: 7 additions & 0 deletions internal/services/network/route_table_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ func TestAccDataSourceRouteTable_basic(t *testing.T) {
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("name").Exists(),
check.That(data.ResourceName).Key("resource_group_name").Exists(),
check.That(data.ResourceName).Key("bgp_route_propagation_enabled").Exists(),
check.That(data.ResourceName).Key("location").Exists(),
check.That(data.ResourceName).Key("route.#").Exists(),
check.That(data.ResourceName).Key("route.#").HasValue("0"),
check.That(data.ResourceName).Key("subnets.#").Exists(),
check.That(data.ResourceName).Key("tags.%").Exists(),
),
},
})
Expand Down
1 change: 1 addition & 0 deletions internal/services/network/route_table_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func resourceRouteTable() *pluginsdk.Resource {
},
},

// TODO rename to bgp_route_propagation_enabled in 4.0
"disable_bgp_route_propagation": {
Type: pluginsdk.TypeBool,
Optional: true,
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/route_table.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ The following arguments are supported:

The following attributes are exported:

* `bgp_route_propagation_enabled` - Boolean flag which controls propagation of routes learned by BGP on that route table.

* `id` - The Route Table ID.

* `location` - The Azure Region in which the Route Table exists.
Expand Down