Skip to content

Commit

Permalink
fix(lb-and-routing-table) : Fix routing table and lbs datasource (#5149)
Browse files Browse the repository at this point in the history
* fix(routing-table): Fix for datasource routing table, handling invalid name

* lbs datasource nil check for subnet name
  • Loading branch information
deepaksibm authored Feb 21, 2024
1 parent c693c20 commit 00fff53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ibm/service/vpc/data_source_ibm_is_lbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,9 @@ func getLbs(d *schema.ResourceData, meta interface{}) error {
if subnet.CRN != nil {
sub[CRN] = *subnet.CRN
}
sub[name] = *subnet.Name
if subnet.Name != nil && *subnet.Name != "" {
sub[name] = *subnet.Name
}
subnetList = append(subnetList, sub)

}
Expand Down
3 changes: 3 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ func dataSourceIBMIBMIsVPCRoutingTableRead(context context.Context, d *schema.Re
routingTable = &r
}
}
if routingTable == nil {
return diag.FromErr(fmt.Errorf("[ERROR] Provided routing table %s cannot be found in the vpc %s", routingTableName, vpcId))
}
}

d.SetId(*routingTable.ID)
Expand Down

0 comments on commit 00fff53

Please sign in to comment.