Skip to content

Commit d04b097

Browse files
committed
fix
1 parent c75938c commit d04b097

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

docs/resources/rdb_read_replica.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-11111
123123
- `name` - Name of the endpoint.
124124
- `hostname` - Hostname of the endpoint. Only one of IP and hostname may be set.
125125
- `enable_ipam` - Indicates whether the IP is managed by IPAM.
126-
- `private_ip` - The list of private IP addresses associated with the resource.
127-
- `id` - The ID of the IP address resource.
128-
- `address` - The private IP address.
129126

130127
## Import
131128

internal/services/rdb/instance.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -563,15 +563,17 @@ func ResourceRdbInstanceRead(ctx context.Context, d *schema.ResourceData, m inte
563563
if pnI, pnExist := flattenPrivateNetwork(res.Endpoints); pnExist {
564564
_ = d.Set("private_network", pnI)
565565

566-
resourceType := ipamAPI.ResourceTypeRdbInstance
567-
opts := &ipam.GetResourcePrivateIPsOptions{
568-
ResourceID: &res.ID,
569-
ResourceType: &resourceType,
570-
PrivateNetworkID: &res.Endpoints[0].PrivateNetwork.PrivateNetworkID,
571-
}
572-
privateIP, err = ipam.GetResourcePrivateIPs(ctx, m, region, opts)
573-
if err != nil {
574-
return diag.FromErr(err)
566+
if res.Endpoints[0].PrivateNetwork.ProvisioningMode == rdb.EndpointPrivateNetworkDetailsProvisioningModeIpam {
567+
resourceType := ipamAPI.ResourceTypeRdbInstance
568+
opts := &ipam.GetResourcePrivateIPsOptions{
569+
ResourceID: &res.ID,
570+
ResourceType: &resourceType,
571+
PrivateNetworkID: &res.Endpoints[0].PrivateNetwork.PrivateNetworkID,
572+
}
573+
privateIP, err = ipam.GetResourcePrivateIPs(ctx, m, region, opts)
574+
if err != nil {
575+
return diag.FromErr(err)
576+
}
575577
}
576578
}
577579
_ = d.Set("private_ip", privateIP)

0 commit comments

Comments
 (0)