Skip to content

Commit

Permalink
feat: Read-only connection string for PGD
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalsawale9 committed Aug 7, 2024
1 parent 6f95fd6 commit 7159bf1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/data-sources/pgd.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ output "data_groups" {
output "witness_groups" {
value = data.biganimal_pgd.this.witness_groups
}
output "ro_connection_uri" {
value = data.biganimal_cluster.this.ro_connection_uri
}
```

## PGD Data Source Example
Expand Down Expand Up @@ -98,6 +102,7 @@ terraform {
- `data_groups` (Attributes Set) Cluster data groups. (see [below for nested schema](#nestedatt--data_groups))
- `id` (String) The ID of this resource.
- `witness_groups` (Attributes Set) (see [below for nested schema](#nestedatt--witness_groups))
- `ro_connection_uri` (String) PGD Cluster read-only connection URI. Only available for high availability clusters.

<a id="nestedatt--data_groups"></a>
### Nested Schema for `data_groups`
Expand Down
1 change: 1 addition & 0 deletions docs/resources/pgd.md
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ Read-Only:
- `metrics_url` (String) The URL to find the metrics of this cluster.
- `phase` (String) Current phase of the data group.
- `resizing_pvc` (Set of String) Resizing PVC.
- `ro_connection_uri` (String) Cluster read-only connection URI. Only available for high availability clusters.

<a id="nestedatt--data_groups--cloud_provider"></a>
### Nested Schema for `data_groups.cloud_provider`
Expand Down
1 change: 1 addition & 0 deletions pkg/models/pgd/api/data_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ type DataGroup struct {
MaintenanceWindow *models.MaintenanceWindow `json:"maintenanceWindow,omitempty"`
ServiceAccountIds *[]string `json:"serviceAccountIds,omitempty"`
PeAllowedPrincipalIds *[]string `json:"peAllowedPrincipalIds,omitempty"`
RoConnectionUri *string `json:"roConnectionUri,omitempty"`
}
1 change: 1 addition & 0 deletions pkg/models/pgd/terraform/data_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ type DataGroup struct {
MaintenanceWindow *models.MaintenanceWindow `tfsdk:"maintenance_window"`
ServiceAccountIds types.Set `tfsdk:"service_account_ids"`
PeAllowedPrincipalIds types.Set `tfsdk:"pe_allowed_principal_ids"`
RoConnectionUri types.String `tfsdk:"ro_connection_uri"`
}
5 changes: 5 additions & 0 deletions pkg/provider/data_source_pgd.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ func (p pgdDataSource) Schema(ctx context.Context, req datasource.SchemaRequest,
Computed: true,
ElementType: types.StringType,
},
"ro_connection_uri": schema.SetAttribute{
Description: "Read-only connection URI.",
Computed: true,
ElementType: types.StringType,
},
},
},
},
Expand Down
6 changes: 6 additions & 0 deletions pkg/provider/resource_pgd.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ func PgdSchema(ctx context.Context) schema.Schema {
},
},
},
"ro_connection_uri": schema.StringAttribute{
MarkdownDescription: "Cluster read-only connection URI. Only available for high availability clusters.",
Computed: true,
PlanModifiers: []planmodifier.String{plan_modifier.CustomConnection()},
},
"instance_type": schema.SingleNestedAttribute{
Description: "Instance type.",
Required: true,
Expand Down Expand Up @@ -1368,6 +1373,7 @@ func buildTFGroupsAs(ctx context.Context, diags *diag.Diagnostics, state tfsdk.S
MaintenanceWindow: apiDgModel.MaintenanceWindow,
ServiceAccountIds: types.SetValueMust(types.StringType, serviceAccIds),
PeAllowedPrincipalIds: types.SetValueMust(types.StringType, principalIds),
RoConnectionUri: types.StringPointerValue(apiDgModel.RoConnectionUri),
}

outPgdTFResource.DataGroups = append(outPgdTFResource.DataGroups, tfDGModel)
Expand Down

0 comments on commit 7159bf1

Please sign in to comment.