diff --git a/pkg/models/cluster.go b/pkg/models/cluster.go index a2a7cf04..ec3b339a 100644 --- a/pkg/models/cluster.go +++ b/pkg/models/cluster.go @@ -188,6 +188,7 @@ type Cluster struct { PgIdentity *string `json:"pgIdentity,omitempty"` BackupScheduleTime *string `json:"scheduleBackup,omitempty"` WalStorage *Storage `json:"walStorage,omitempty"` + Connection *ClusterConnection `json:"connection,omitempty"` } // IsHealthy checks to see if the cluster has the right condition 'biganimal.com/deployed' diff --git a/pkg/provider/resource_cluster.go b/pkg/provider/resource_cluster.go index 536ad501..318352f3 100644 --- a/pkg/provider/resource_cluster.go +++ b/pkg/provider/resource_cluster.go @@ -829,11 +829,6 @@ func readCluster(ctx context.Context, client *api.ClusterClient, tfClusterResour return err } - connection, err := client.ConnectionString(ctx, tfClusterResource.ProjectId, *tfClusterResource.ClusterId) - if err != nil { - return err - } - tfClusterResource.ID = types.StringValue(fmt.Sprintf("%s/%s", tfClusterResource.ProjectId, *tfClusterResource.ClusterId)) tfClusterResource.ClusterId = responseCluster.ClusterId tfClusterResource.ClusterName = types.StringPointerValue(responseCluster.ClusterName) @@ -855,9 +850,9 @@ func readCluster(ctx context.Context, client *api.ClusterClient, tfClusterResour } tfClusterResource.ResizingPvc = StringSliceToList(responseCluster.ResizingPvc) tfClusterResource.ReadOnlyConnections = types.BoolPointerValue(responseCluster.ReadOnlyConnections) - tfClusterResource.ConnectionUri = types.StringPointerValue(&connection.PgUri) - tfClusterResource.RoConnectionUri = types.StringPointerValue(&connection.ReadOnlyPgUri) - tfClusterResource.ServiceName = types.StringPointerValue(&connection.ServiceName) + tfClusterResource.ConnectionUri = types.StringPointerValue(&responseCluster.Connection.PgUri) + tfClusterResource.RoConnectionUri = types.StringPointerValue(&responseCluster.Connection.ReadOnlyPgUri) + tfClusterResource.ServiceName = types.StringPointerValue(&responseCluster.Connection.ServiceName) tfClusterResource.CspAuth = types.BoolPointerValue(responseCluster.CSPAuth) tfClusterResource.LogsUrl = responseCluster.LogsUrl tfClusterResource.MetricsUrl = responseCluster.MetricsUrl