fix: refactor publish command (#14)
feat: add connection info
fix: prevent postgresql from failing when encryption is empty
## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #14
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
parent
5ec2ab8c67
commit
a9df5b0ff5
8 changed files with 650 additions and 425 deletions
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func mapGetInstanceResponseToModel(ctx context.Context, m *postgresflexalpharesource.InstanceModel, resp *postgresflex.GetInstanceResponse) error {
|
||||
tflog.Info(ctx, ">>>> MSH DEBUG <<<<", map[string]interface{}{
|
||||
tflog.Debug(ctx, ">>>> MSH DEBUG <<<<", map[string]interface{}{
|
||||
"id": m.Id.ValueString(),
|
||||
"instance_id": m.InstanceId.ValueString(),
|
||||
"backup_schedule": m.BackupSchedule.ValueString(),
|
||||
|
|
@ -47,17 +47,17 @@ func mapGetInstanceResponseToModel(ctx context.Context, m *postgresflexalphareso
|
|||
},
|
||||
)
|
||||
}
|
||||
|
||||
m.ConnectionInfo.Host = types.StringValue(resp.ConnectionInfo.GetHost())
|
||||
m.ConnectionInfo.Port = types.Int64Value(resp.ConnectionInfo.GetPort())
|
||||
|
||||
m.FlavorId = types.StringValue(resp.GetFlavorId())
|
||||
if m.Id.IsNull() || m.Id.IsUnknown() {
|
||||
m.Id = utils.BuildInternalTerraformId(m.ProjectId.ValueString(), m.Region.ValueString(), m.InstanceId.ValueString())
|
||||
}
|
||||
m.InstanceId = types.StringPointerValue(resp.Id)
|
||||
|
||||
//m.IsDeletable = types.BoolUnknown()
|
||||
//if isDel, ok := resp.GetIsDeletableOk(); ok {
|
||||
// m.IsDeletable = types.BoolValue(isDel)
|
||||
m.IsDeletable = types.BoolValue(resp.GetIsDeletable())
|
||||
//}
|
||||
|
||||
netAcl, diags := types.ListValueFrom(ctx, types.StringType, resp.Network.GetAcl())
|
||||
if diags.HasError() {
|
||||
|
|
@ -93,10 +93,6 @@ func mapGetInstanceResponseToModel(ctx context.Context, m *postgresflexalphareso
|
|||
|
||||
m.Name = types.StringValue(resp.GetName())
|
||||
|
||||
//m.Status = types.StringUnknown()
|
||||
//if status, ok := resp.GetStatusOk(); ok {
|
||||
// m.Status = types.StringValue(string(status))
|
||||
//}
|
||||
m.Status = types.StringValue(string(resp.GetStatus()))
|
||||
|
||||
storage, diags := postgresflexalpharesource.NewStorageValue(
|
||||
|
|
@ -117,13 +113,14 @@ func mapGetInstanceResponseToModel(ctx context.Context, m *postgresflexalphareso
|
|||
|
||||
func mapGetDataInstanceResponseToModel(ctx context.Context, m *postgresflexalphadatasource.InstanceModel, resp *postgresflex.GetInstanceResponse) error {
|
||||
m.BackupSchedule = types.StringValue(resp.GetBackupSchedule())
|
||||
//nolint:gocritic
|
||||
// m.Encryption = postgresflexalpharesource.EncryptionValue{
|
||||
// KekKeyId: types.StringValue(resp.Encryption.GetKekKeyId()),
|
||||
// KekKeyRingId: types.StringValue(resp.Encryption.GetKekKeyRingId()),
|
||||
// KekKeyVersion: types.StringValue(resp.Encryption.GetKekKeyVersion()),
|
||||
// ServiceAccount: types.StringValue(resp.Encryption.GetServiceAccount()),
|
||||
// }
|
||||
m.Encryption = postgresflexalphadatasource.EncryptionValue{
|
||||
KekKeyId: types.StringValue(resp.Encryption.GetKekKeyId()),
|
||||
KekKeyRingId: types.StringValue(resp.Encryption.GetKekKeyRingId()),
|
||||
KekKeyVersion: types.StringValue(resp.Encryption.GetKekKeyVersion()),
|
||||
ServiceAccount: types.StringValue(resp.Encryption.GetServiceAccount()),
|
||||
}
|
||||
m.ConnectionInfo.Host = types.StringValue(resp.ConnectionInfo.GetHost())
|
||||
m.ConnectionInfo.Port = types.Int64Value(resp.ConnectionInfo.GetPort())
|
||||
m.FlavorId = types.StringValue(resp.GetFlavorId())
|
||||
m.Id = utils.BuildInternalTerraformId(m.ProjectId.ValueString(), m.Region.ValueString(), m.InstanceId.ValueString())
|
||||
m.InstanceId = types.StringPointerValue(resp.Id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue