Skip to content

Commit 8fb04dc

Browse files
committed
Set peering provider on import
1 parent 631a8cd commit 8fb04dc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mongodbatlas/resource_mongodbatlas_vpc_peering_connection.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ func resourceVpcPeeringConnectionImportState(d *schema.ResourceData, meta interf
300300
return nil, err
301301
}
302302

303+
// https://docs.atlas.mongodb.com/reference/api/vpc-get-connection/#example-response
304+
// Atlas API does not return ProviderName, so we have to guess it from other parameters
305+
if peer.AwsAccountID != "" {
306+
d.Set("provider_name", "AWS")
307+
} else if peer.GcpProjectID != "" {
308+
d.Set("provider_name", "GCP")
309+
}
310+
303311
d.SetId(peer.ID)
304312
if err := d.Set("group", gid); err != nil {
305313
log.Printf("[WARN] Error setting group for (%s): %s", d.Id(), err)

0 commit comments

Comments
 (0)