Skip to content

Commit 884a19a

Browse files
authored
private-link: check for deleted db (#291)
If the database is in a Terminated state, the list of private links returned will be nil. This adds a check for that nil value and will result in removing the private link from the local state because the remote private link has been deleted.
1 parent 5f41462 commit 884a19a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

internal/provider/resource_private_link.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ func resourcePrivateLinkRead(ctx context.Context, d *schema.ResourceData, meta i
144144
if err != nil {
145145
return diag.FromErr(err)
146146
}
147-
148-
if string(*privateLinks.ServiceName) == serviceName {
147+
if privateLinks != nil && string(*privateLinks.ServiceName) == serviceName {
149148
if err := setPrivateLinkData(d, databaseID, datacenterID, serviceName, privateLinks.AllowedPrincipals); err != nil {
150149
return diag.FromErr(err)
151150
}

0 commit comments

Comments
 (0)