diff --git a/examples/data-sources/biganimal_analytics_cluster/data-source.tf b/examples/data-sources/biganimal_analytics_cluster/data-source.tf index 1ac6c615..038c78fc 100644 --- a/examples/data-sources/biganimal_analytics_cluster/data-source.tf +++ b/examples/data-sources/biganimal_analytics_cluster/data-source.tf @@ -17,6 +17,10 @@ output "backup_retention_period" { value = data.biganimal_analytics_cluster.this.backup_retention_period } +output "backup_schedule_time" { + value = data.biganimal_analytics_cluster.this.backup_schedule_time +} + output "cluster_name" { value = data.biganimal_analytics_cluster.this.cluster_name } diff --git a/examples/data-sources/biganimal_cluster/data-source.tf b/examples/data-sources/biganimal_cluster/data-source.tf index fc0ed105..67630358 100644 --- a/examples/data-sources/biganimal_cluster/data-source.tf +++ b/examples/data-sources/biganimal_cluster/data-source.tf @@ -21,6 +21,10 @@ output "backup_retention_period" { value = data.biganimal_cluster.this.backup_retention_period } +output "backup_schedule_time" { + value = data.biganimal_cluster.this.backup_schedule_time +} + output "cluster_name" { value = data.biganimal_cluster.this.cluster_name } diff --git a/examples/data-sources/biganimal_faraway_replica/data-source.tf b/examples/data-sources/biganimal_faraway_replica/data-source.tf index ca60f853..27a4d80a 100644 --- a/examples/data-sources/biganimal_faraway_replica/data-source.tf +++ b/examples/data-sources/biganimal_faraway_replica/data-source.tf @@ -29,6 +29,10 @@ output "backup_retention_period" { value = data.biganimal_faraway_replica.this.backup_retention_period } +output "backup_schedule_time" { + value = data.biganimal_faraway_replica.this.backup_schedule_time +} + output "cluster_name" { value = data.biganimal_faraway_replica.this.cluster_name } diff --git a/examples/resources/biganimal_analytics_cluster/aws/resource.tf b/examples/resources/biganimal_analytics_cluster/aws/resource.tf index db730995..78d1ef07 100644 --- a/examples/resources/biganimal_analytics_cluster/aws/resource.tf +++ b/examples/resources/biganimal_analytics_cluster/aws/resource.tf @@ -54,7 +54,8 @@ resource "biganimal_analytics_cluster" "analytics_cluster" { ] backup_retention_period = "30d" - csp_auth = false + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 + csp_auth = false instance_type = "aws:m6id.12xlarge" password = resource.random_password.password.result diff --git a/examples/resources/biganimal_cluster/ha/resource.tf b/examples/resources/biganimal_cluster/ha/resource.tf index bd8bd140..78bf6e16 100644 --- a/examples/resources/biganimal_cluster/ha/resource.tf +++ b/examples/resources/biganimal_cluster/ha/resource.tf @@ -44,6 +44,7 @@ resource "biganimal_cluster" "ha_cluster" { ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { id = "ha" nodes = 3 diff --git a/examples/resources/biganimal_cluster/single_node/aws/resource.tf b/examples/resources/biganimal_cluster/single_node/aws/resource.tf index c98105a6..0e570320 100644 --- a/examples/resources/biganimal_cluster/single_node/aws/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/aws/resource.tf @@ -44,6 +44,7 @@ resource "biganimal_cluster" "single_node_cluster" { ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { id = "single" nodes = 1 diff --git a/examples/resources/biganimal_cluster/single_node/azure/resource.tf b/examples/resources/biganimal_cluster/single_node/azure/resource.tf index 034ddb78..866e8057 100644 --- a/examples/resources/biganimal_cluster/single_node/azure/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/azure/resource.tf @@ -44,6 +44,7 @@ resource "biganimal_cluster" "single_node_cluster" { ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { id = "single" nodes = 1 diff --git a/examples/resources/biganimal_cluster/single_node/gcp/resource.tf b/examples/resources/biganimal_cluster/single_node/gcp/resource.tf index 4e702e43..9bb55c49 100644 --- a/examples/resources/biganimal_cluster/single_node/gcp/resource.tf +++ b/examples/resources/biganimal_cluster/single_node/gcp/resource.tf @@ -44,6 +44,7 @@ resource "biganimal_cluster" "single_node_cluster" { ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { id = "single" nodes = 1 diff --git a/examples/resources/biganimal_faraway_replica/aws/resource.tf b/examples/resources/biganimal_faraway_replica/aws/resource.tf index 8cf1bbb4..90aabd58 100644 --- a/examples/resources/biganimal_faraway_replica/aws/resource.tf +++ b/examples/resources/biganimal_faraway_replica/aws/resource.tf @@ -43,8 +43,9 @@ resource "biganimal_faraway_replica" "faraway_replica" { ] backup_retention_period = "8d" - csp_auth = false - instance_type = "aws:c6i.large" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 + csp_auth = false + instance_type = "aws:c6i.large" // only following pg_config parameters are configurable for faraway replica // max_connections, max_locks_per_transaction, max_prepared_transactions, max_wal_senders, max_worker_processes. diff --git a/examples/resources/biganimal_faraway_replica/azure/resource.tf b/examples/resources/biganimal_faraway_replica/azure/resource.tf index 17f522dd..f0d30d82 100644 --- a/examples/resources/biganimal_faraway_replica/azure/resource.tf +++ b/examples/resources/biganimal_faraway_replica/azure/resource.tf @@ -43,8 +43,9 @@ resource "biganimal_faraway_replica" "faraway_replica" { ] backup_retention_period = "8d" - csp_auth = false - instance_type = "azure:Standard_D2s_v3" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 + csp_auth = false + instance_type = "azure:Standard_D2s_v3" // only following pg_config parameters are configurable for faraway replica // max_connections, max_locks_per_transaction, max_prepared_transactions, max_wal_senders, max_worker_processes. diff --git a/examples/resources/biganimal_faraway_replica/cluster_and_faraway_replica/resource.tf b/examples/resources/biganimal_faraway_replica/cluster_and_faraway_replica/resource.tf index 931f92a0..326fdd0c 100644 --- a/examples/resources/biganimal_faraway_replica/cluster_and_faraway_replica/resource.tf +++ b/examples/resources/biganimal_faraway_replica/cluster_and_faraway_replica/resource.tf @@ -85,8 +85,9 @@ resource "biganimal_faraway_replica" "faraway_replica" { ] backup_retention_period = "8d" - csp_auth = false - instance_type = "azure:Standard_D2s_v3" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 + csp_auth = false + instance_type = "azure:Standard_D2s_v3" // only following pg_config parameters are configurable for faraway replica // max_connections, max_locks_per_transaction, max_prepared_transactions, max_wal_senders, max_worker_processes. diff --git a/examples/resources/biganimal_faraway_replica/gcp/resource.tf b/examples/resources/biganimal_faraway_replica/gcp/resource.tf index 9381e555..b3be1eaa 100644 --- a/examples/resources/biganimal_faraway_replica/gcp/resource.tf +++ b/examples/resources/biganimal_faraway_replica/gcp/resource.tf @@ -43,8 +43,9 @@ resource "biganimal_faraway_replica" "faraway_replica" { ] backup_retention_period = "8d" - csp_auth = false - instance_type = "gcp:e2-highcpu-4" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 + csp_auth = false + instance_type = "gcp:e2-highcpu-4" // only following pg_config parameters are configurable for faraway replica // max_connections, max_locks_per_transaction, max_prepared_transactions, max_wal_senders, max_worker_processes. diff --git a/examples/resources/biganimal_pgd/aws/data_group/resource.tf b/examples/resources/biganimal_pgd/aws/data_group/resource.tf index bcab1513..0ce24dce 100644 --- a/examples/resources/biganimal_pgd/aws/data_group/resource.tf +++ b/examples/resources/biganimal_pgd/aws/data_group/resource.tf @@ -54,6 +54,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 diff --git a/examples/resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf index 479f5530..15f3f4dd 100644 --- a/examples/resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/aws/data_groups_with_witness_group/resource.tf @@ -54,6 +54,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 @@ -116,6 +117,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 diff --git a/examples/resources/biganimal_pgd/azure/data_group/resource.tf b/examples/resources/biganimal_pgd/azure/data_group/resource.tf index b9a33336..9867c055 100644 --- a/examples/resources/biganimal_pgd/azure/data_group/resource.tf +++ b/examples/resources/biganimal_pgd/azure/data_group/resource.tf @@ -54,6 +54,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 diff --git a/examples/resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf index 13b43fd9..f6909e73 100644 --- a/examples/resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/azure/data_groups_with_witness_group/resource.tf @@ -54,6 +54,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 @@ -116,6 +117,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 diff --git a/examples/resources/biganimal_pgd/gcp/data_group/resource.tf b/examples/resources/biganimal_pgd/gcp/data_group/resource.tf index 9899dae9..6f5553d3 100644 --- a/examples/resources/biganimal_pgd/gcp/data_group/resource.tf +++ b/examples/resources/biganimal_pgd/gcp/data_group/resource.tf @@ -54,6 +54,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 diff --git a/examples/resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf b/examples/resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf index f3f8ab56..5ec94639 100644 --- a/examples/resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf +++ b/examples/resources/biganimal_pgd/gcp/data_groups_with_witness_group/resource.tf @@ -54,6 +54,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 @@ -120,6 +121,7 @@ resource "biganimal_pgd" "pgd_cluster" { }, ] backup_retention_period = "6d" + # backup_schedule_time = "0 5 1 * * *" //24 hour format cron expression e.g. "0 5 1 * * *" is 01:05 cluster_architecture = { cluster_architecture_id = "pgd" nodes = 3 diff --git a/pkg/models/cluster.go b/pkg/models/cluster.go index c5bc2a95..a2a7cf04 100644 --- a/pkg/models/cluster.go +++ b/pkg/models/cluster.go @@ -186,6 +186,7 @@ type Cluster struct { EncryptionKeyIdReq *string `json:"keyId,omitempty"` EncryptionKeyResp *EncryptionKey `json:"encryptionKey,omitempty"` PgIdentity *string `json:"pgIdentity,omitempty"` + BackupScheduleTime *string `json:"scheduleBackup,omitempty"` WalStorage *Storage `json:"walStorage,omitempty"` } diff --git a/pkg/models/pgd/api/data_group.go b/pkg/models/pgd/api/data_group.go index b71495f3..2a36aa73 100644 --- a/pkg/models/pgd/api/data_group.go +++ b/pkg/models/pgd/api/data_group.go @@ -1,6 +1,8 @@ package api -import "github.com/EnterpriseDB/terraform-provider-biganimal/pkg/models" +import ( + "github.com/EnterpriseDB/terraform-provider-biganimal/pkg/models" +) type DataGroup struct { GroupId *string `json:"groupId,omitempty"` @@ -30,5 +32,6 @@ type DataGroup struct { PeAllowedPrincipalIds *[]string `json:"peAllowedPrincipalIds,omitempty"` RoConnectionUri *string `json:"roConnectionUri,omitempty"` ReadOnlyConnections *bool `json:"readOnlyConnections,omitempty"` + BackupScheduleTime *string `json:"scheduleBackup,omitempty"` WalStorage *models.Storage `json:"walStorage,omitempty"` } diff --git a/pkg/models/pgd/terraform/data_group.go b/pkg/models/pgd/terraform/data_group.go index aa31b6eb..3f7393ed 100644 --- a/pkg/models/pgd/terraform/data_group.go +++ b/pkg/models/pgd/terraform/data_group.go @@ -33,5 +33,6 @@ type DataGroup struct { PeAllowedPrincipalIds types.Set `tfsdk:"pe_allowed_principal_ids"` RoConnectionUri types.String `tfsdk:"ro_connection_uri"` ReadOnlyConnections *bool `tfsdk:"read_only_connections"` + BackupScheduleTime types.String `tfsdk:"backup_schedule_time"` WalStorage *Storage `tfsdk:"wal_storage"` } diff --git a/pkg/provider/common.go b/pkg/provider/common.go index 0cbcc659..4d3e9a51 100644 --- a/pkg/provider/common.go +++ b/pkg/provider/common.go @@ -35,6 +35,12 @@ func buildAPIReqAssignTags(tfRsrcTags []commonTerraform.Tag) []commonApi.Tag { return tags } +var ResourceBackupScheduleTime = schema.StringAttribute{ + MarkdownDescription: "Backup schedule time in 24 hour cron expression format.", + Optional: true, + Computed: true, +} + var resourceWal = schema.SingleNestedAttribute{ Description: "Use a separate storage volume for Write-Ahead Logs (Recommended for high write workloads)", Optional: true, diff --git a/pkg/provider/data_source_analytics_cluster.go b/pkg/provider/data_source_analytics_cluster.go index f26057b8..9b8a7a7d 100644 --- a/pkg/provider/data_source_analytics_cluster.go +++ b/pkg/provider/data_source_analytics_cluster.go @@ -210,6 +210,7 @@ func (r *analyticsClusterDataSource) Schema(ctx context.Context, req datasource. }, }, }, + "backup_schedule_time": ResourceBackupScheduleTime, }, } } diff --git a/pkg/provider/data_source_cluster.go b/pkg/provider/data_source_cluster.go index 5dd02003..56e55014 100644 --- a/pkg/provider/data_source_cluster.go +++ b/pkg/provider/data_source_cluster.go @@ -388,7 +388,8 @@ func (c *clusterDataSource) Schema(ctx context.Context, req datasource.SchemaReq MarkdownDescription: "Cluster connection service name.", Computed: true, }, - "wal_storage": resourceWal, + "backup_schedule_time": ResourceBackupScheduleTime, + "wal_storage": resourceWal, }, } } diff --git a/pkg/provider/data_source_fareplica.go b/pkg/provider/data_source_fareplica.go index 8ff5b3df..4d6e9cf4 100644 --- a/pkg/provider/data_source_fareplica.go +++ b/pkg/provider/data_source_fareplica.go @@ -271,7 +271,8 @@ func (c *FAReplicaData) Schema(ctx context.Context, req datasource.SchemaRequest }, }, }, - "wal_storage": resourceWal, + "backup_schedule_time": ResourceBackupScheduleTime, + "wal_storage": resourceWal, }, } } diff --git a/pkg/provider/data_source_pgd.go b/pkg/provider/data_source_pgd.go index c0f587a9..31e75f8c 100644 --- a/pkg/provider/data_source_pgd.go +++ b/pkg/provider/data_source_pgd.go @@ -284,7 +284,8 @@ func (p pgdDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, Description: "Is read-only connections enabled.", Computed: true, }, - "wal_storage": resourceWal, + "backup_schedule_time": ResourceBackupScheduleTime, + "wal_storage": resourceWal, }, }, }, diff --git a/pkg/provider/resource_analytics_cluster.go b/pkg/provider/resource_analytics_cluster.go index 5eabc97a..163e96b3 100644 --- a/pkg/provider/resource_analytics_cluster.go +++ b/pkg/provider/resource_analytics_cluster.go @@ -60,6 +60,7 @@ type analyticsClusterResourceModel struct { PeAllowedPrincipalIds types.Set `tfsdk:"pe_allowed_principal_ids"` Pause types.Bool `tfsdk:"pause"` Tags []commonTerraform.Tag `tfsdk:"tags"` + BackupScheduleTime types.String `tfsdk:"backup_schedule_time"` Timeouts timeouts.Value `tfsdk:"timeouts"` } @@ -302,6 +303,7 @@ func (r *analyticsClusterResource) Schema(ctx context.Context, req resource.Sche plan_modifier.CustomAssignTags(), }, }, + "backup_schedule_time": ResourceBackupScheduleTime, }, } } @@ -407,6 +409,7 @@ func generateAnalyticsClusterModelCreate(ctx context.Context, client *api.Cluste CSPAuth: clusterResource.CspAuth.ValueBoolPointer(), PrivateNetworking: clusterResource.PrivateNetworking.ValueBoolPointer(), BackupRetentionPeriod: clusterResource.BackupRetentionPeriod.ValueStringPointer(), + BackupScheduleTime: clusterResource.BackupScheduleTime.ValueStringPointer(), } cluster.ClusterId = nil @@ -506,6 +509,7 @@ func readAnalyticsCluster(ctx context.Context, client *api.ClusterClient, tfClus tfClusterResource.LogsUrl = responseCluster.LogsUrl tfClusterResource.MetricsUrl = responseCluster.MetricsUrl tfClusterResource.BackupRetentionPeriod = types.StringPointerValue(responseCluster.BackupRetentionPeriod) + tfClusterResource.BackupScheduleTime = types.StringPointerValue(responseCluster.BackupScheduleTime) tfClusterResource.PgVersion = types.StringValue(responseCluster.PgVersion.PgVersionId) tfClusterResource.PgType = types.StringValue(responseCluster.PgType.PgTypeId) tfClusterResource.PrivateNetworking = types.BoolPointerValue(responseCluster.PrivateNetworking) diff --git a/pkg/provider/resource_cluster.go b/pkg/provider/resource_cluster.go index 48b1456e..e748a7ae 100644 --- a/pkg/provider/resource_cluster.go +++ b/pkg/provider/resource_cluster.go @@ -82,6 +82,7 @@ type ClusterResourceModel struct { VolumeSnapshot types.Bool `tfsdk:"volume_snapshot_backup"` Tags []commonTerraform.Tag `tfsdk:"tags"` ServiceName types.String `tfsdk:"service_name"` + BackupScheduleTime types.String `tfsdk:"backup_schedule_time"` WalStorage *StorageResourceModel `tfsdk:"wal_storage"` Timeouts timeouts.Value `tfsdk:"timeouts"` @@ -577,7 +578,8 @@ func (c *clusterResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}, }, - "wal_storage": resourceWal, + "backup_schedule_time": ResourceBackupScheduleTime, + "wal_storage": resourceWal, }, } } @@ -859,6 +861,7 @@ func readCluster(ctx context.Context, client *api.ClusterClient, tfClusterResour tfClusterResource.LogsUrl = responseCluster.LogsUrl tfClusterResource.MetricsUrl = responseCluster.MetricsUrl tfClusterResource.BackupRetentionPeriod = types.StringPointerValue(responseCluster.BackupRetentionPeriod) + tfClusterResource.BackupScheduleTime = types.StringPointerValue(responseCluster.BackupScheduleTime) tfClusterResource.PgVersion = types.StringValue(responseCluster.PgVersion.PgVersionId) tfClusterResource.PgType = types.StringValue(responseCluster.PgType.PgTypeId) tfClusterResource.FarawayReplicaIds = StringSliceToSet(responseCluster.FarawayReplicaIds) @@ -1108,6 +1111,7 @@ func (c *clusterResource) generateGenericClusterModel(ctx context.Context, clust PrivateNetworking: clusterResource.PrivateNetworking.ValueBoolPointer(), ReadOnlyConnections: clusterResource.ReadOnlyConnections.ValueBoolPointer(), BackupRetentionPeriod: clusterResource.BackupRetentionPeriod.ValueStringPointer(), + BackupScheduleTime: clusterResource.BackupScheduleTime.ValueStringPointer(), SuperuserAccess: clusterResource.SuperuserAccess.ValueBoolPointer(), VolumeSnapshot: clusterResource.VolumeSnapshot.ValueBoolPointer(), } diff --git a/pkg/provider/resource_fareplica.go b/pkg/provider/resource_fareplica.go index 21b56dc4..74c2b532 100644 --- a/pkg/provider/resource_fareplica.go +++ b/pkg/provider/resource_fareplica.go @@ -65,6 +65,7 @@ type FAReplicaResourceModel struct { TransparentDataEncryptionAction types.String `tfsdk:"transparent_data_encryption_action"` VolumeSnapshot types.Bool `tfsdk:"volume_snapshot_backup"` Tags []commonTerraform.Tag `tfsdk:"tags"` + BackupScheduleTime types.String `tfsdk:"backup_schedule_time"` WalStorage *StorageResourceModel `tfsdk:"wal_storage"` Timeouts timeouts.Value `tfsdk:"timeouts"` @@ -423,7 +424,8 @@ func (r *FAReplicaResource) Schema(ctx context.Context, req resource.SchemaReque plan_modifier.CustomAssignTags(), }, }, - "wal_storage": resourceWal, + "backup_schedule_time": ResourceBackupScheduleTime, + "wal_storage": resourceWal, }, } } @@ -627,6 +629,7 @@ func readFAReplica(ctx context.Context, client *api.ClusterClient, fAReplicaReso fAReplicaResourceModel.LogsUrl = responseCluster.LogsUrl fAReplicaResourceModel.MetricsUrl = responseCluster.MetricsUrl fAReplicaResourceModel.BackupRetentionPeriod = types.StringPointerValue(responseCluster.BackupRetentionPeriod) + fAReplicaResourceModel.BackupScheduleTime = types.StringPointerValue(responseCluster.BackupScheduleTime) fAReplicaResourceModel.PrivateNetworking = types.BoolPointerValue(responseCluster.PrivateNetworking) fAReplicaResourceModel.ClusterArchitecture = &ClusterArchitectureResourceModel{ Id: responseCluster.ClusterArchitecture.ClusterArchitectureId, @@ -777,6 +780,7 @@ func (r *FAReplicaResource) generateGenericFAReplicaModel(ctx context.Context, f CSPAuth: fAReplicaResourceModel.CspAuth.ValueBoolPointer(), PrivateNetworking: fAReplicaResourceModel.PrivateNetworking.ValueBoolPointer(), BackupRetentionPeriod: fAReplicaResourceModel.BackupRetentionPeriod.ValueStringPointer(), + BackupScheduleTime: fAReplicaResourceModel.BackupScheduleTime.ValueStringPointer(), } if fAReplicaResourceModel.WalStorage != nil { diff --git a/pkg/provider/resource_pgd.go b/pkg/provider/resource_pgd.go index 9ce1744e..b148eab6 100644 --- a/pkg/provider/resource_pgd.go +++ b/pkg/provider/resource_pgd.go @@ -416,7 +416,8 @@ func PgdSchema(ctx context.Context) schema.Schema { Description: "Is read-only connections enabled.", Optional: true, }, - "wal_storage": resourceWal, + "backup_schedule_time": ResourceBackupScheduleTime, + "wal_storage": resourceWal, }, }, }, @@ -694,6 +695,7 @@ func (p pgdResource) Create(ctx context.Context, req resource.CreateRequest, res apiDGModel := pgdApi.DataGroup{ AllowedIpRanges: buildRequestAllowedIpRanges(v.AllowedIpRanges), BackupRetentionPeriod: v.BackupRetentionPeriod, + BackupScheduleTime: v.BackupScheduleTime.ValueStringPointer(), Provider: v.Provider, ClusterArchitecture: clusterArch, CspAuth: v.CspAuth, @@ -711,6 +713,7 @@ func (p pgdResource) Create(ctx context.Context, req resource.CreateRequest, res ReadOnlyConnections: v.ReadOnlyConnections, WalStorage: walStorage, } + *clusterReqBody.Groups = append(*clusterReqBody.Groups, apiDGModel) } @@ -980,6 +983,7 @@ func (p pgdResource) Update(ctx context.Context, req resource.UpdateRequest, res ClusterType: utils.ToPointer("data_group"), AllowedIpRanges: buildRequestAllowedIpRanges(v.AllowedIpRanges), BackupRetentionPeriod: v.BackupRetentionPeriod, + BackupScheduleTime: v.BackupScheduleTime.ValueStringPointer(), CspAuth: v.CspAuth, InstanceType: v.InstanceType, PgConfig: v.PgConfig, @@ -1422,6 +1426,7 @@ func buildTFGroupsAs(ctx context.Context, diags *diag.Diagnostics, state tfsdk.S GroupId: types.StringPointerValue(apiRespDgModel.GroupId), AllowedIpRanges: allwdIpRngsSet, BackupRetentionPeriod: apiRespDgModel.BackupRetentionPeriod, + BackupScheduleTime: types.StringPointerValue(apiRespDgModel.BackupScheduleTime), ClusterArchitecture: clusterArch, ClusterName: types.StringPointerValue(apiRespDgModel.ClusterName), ClusterType: types.StringPointerValue(apiRespDgModel.ClusterType),