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

[Bug Fix] - azurerm_express_route_circuit_peering - Fix ID not handled bug #26441

Merged
merged 1 commit into from
Jun 24, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,21 @@ func dataSourceExpressRouteCircuitPeering() *pluginsdk.Resource {
func dataSourceExpressRouteCircuitPeeringRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.ExpressRouteCircuitPeerings
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
defer cancel()

// TODO this should be constructed?
id, err := commonids.ParseExpressRouteCircuitPeeringID(d.Id())
if err != nil {
return err
}
id := commonids.NewExpressRouteCircuitPeeringID(subscriptionId, d.Get("resource_group_name").(string), d.Get("express_route_circuit_name").(string), d.Get("peering_type").(string))

resp, err := client.Get(ctx, *id)
resp, err := client.Get(ctx, id)
if err != nil {
if response.WasNotFound(resp.HttpResponse) {
return fmt.Errorf("%s was not found", id)
}
return fmt.Errorf("retrieving %s: %+v", *id, err)
return fmt.Errorf("retrieving %s: %+v", id, err)
}

d.SetId(id.ID())

d.Set("peering_type", id.PeeringName)
d.Set("express_route_circuit_name", id.CircuitName)
d.Set("resource_group_name", id.ResourceGroupName)
Expand Down
Loading