Skip to content

Commit

Permalink
fix: refactor connection read
Browse files Browse the repository at this point in the history
  • Loading branch information
wai-wong-edb committed Jan 3, 2025
1 parent f7854de commit e8794a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions pkg/models/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 3 additions & 8 deletions pkg/provider/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit e8794a4

Please sign in to comment.