diff --git a/README.md b/README.md
index c0271d09..4272c92f 100644
--- a/README.md
+++ b/README.md
@@ -99,7 +99,7 @@ To attach access management tags to resources in this module, you need the follo
| [name](#input\_name) | The name to give the Postgresql instance. | `string` | n/a | yes |
| [pg\_version](#input\_pg\_version) | Version of the PostgreSQL instance to provision. If no value is passed, the current preferred version of IBM Cloud Databases is used. | `string` | `null` | no |
| [pitr\_id](#input\_pitr\_id) | (Optional) The ID of the source deployment PostgreSQL instance that you want to recover back to. The PostgreSQL instance is expected to be in an up and in running state. | `string` | `null` | no |
-| [pitr\_time](#input\_pitr\_time) | (Optional) The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) that you want to restore to. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp ). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr | `string` | `null` | no |
+| [pitr\_time](#input\_pitr\_time) | (Optional) The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) for any time in the last 7 days that you want to restore to. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp ). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr | `string` | `null` | no |
| [plan\_validation](#input\_plan\_validation) | Enable or disable validating the database parameters for PostgreSQL during the plan phase. | `bool` | `true` | no |
| [region](#input\_region) | The region where you want to deploy your instance. | `string` | `"us-south"` | no |
| [remote\_leader\_crn](#input\_remote\_leader\_crn) | A CRN of the leader database to make the replica(read-only) deployment. The leader database is created by a database deployment with the same service ID. A read-only replica is set up to replicate all of your data from the leader deployment to the replica deployment by using asynchronous replication. For more information, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-read-only-replicas | `string` | `null` | no |
diff --git a/examples/pitr/main.tf b/examples/pitr/main.tf
index 4377dc0b..fb1d3401 100644
--- a/examples/pitr/main.tf
+++ b/examples/pitr/main.tf
@@ -10,10 +10,6 @@ module "resource_group" {
existing_resource_group_name = var.resource_group
}
-data "ibm_database_point_in_time_recovery" "database_pitr" {
- deployment_id = var.pitr_id
-}
-
# New ICD postgresql database instance pointing to a PITR time
module "postgresql_db_pitr" {
source = "../.."
@@ -28,5 +24,5 @@ module "postgresql_db_pitr" {
members = var.members
pg_version = var.pg_version
pitr_id = var.pitr_id
- pitr_time = data.ibm_database_point_in_time_recovery.database_pitr.earliest_point_in_time_recovery_time
+ pitr_time = var.pitr_time == "" ? " " : var.pitr_time
}
diff --git a/examples/pitr/outputs.tf b/examples/pitr/outputs.tf
index a2b13432..9ff73d40 100644
--- a/examples/pitr/outputs.tf
+++ b/examples/pitr/outputs.tf
@@ -14,5 +14,5 @@ output "pitr_postgresql_db_version" {
output "pitr_time" {
description = "PITR timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) used to create PITR instance"
- value = data.ibm_database_point_in_time_recovery.database_pitr.earliest_point_in_time_recovery_time
+ value = var.pitr_time
}
diff --git a/examples/pitr/variables.tf b/examples/pitr/variables.tf
index 46ee2980..41df341d 100644
--- a/examples/pitr/variables.tf
+++ b/examples/pitr/variables.tf
@@ -45,6 +45,11 @@ variable "pitr_id" {
description = "The ID of the source deployment PostgreSQL instance that you want to recover back to. The PostgreSQL instance is expected to be in an up and in running state."
}
+variable "pitr_time" {
+ type = string
+ description = "The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) for any time in the last 7 days that you want to restore to. If empty string (\"\") or spaced string (\" \") is passed, latest_point_in_time_recovery_time will be used as pitr_time. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp ). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr"
+}
+
variable "members" {
type = number
description = "Allocated number of members. Members must be same or higher than the source deployment PostgreSQL instance."
diff --git a/module-metadata.json b/module-metadata.json
index 74e99385..77472b0c 100644
--- a/module-metadata.json
+++ b/module-metadata.json
@@ -216,7 +216,7 @@
"pitr_time": {
"name": "pitr_time",
"type": "string",
- "description": "(Optional) The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) that you want to restore to. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp \u003cdeployment name or CRN\u003e). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr",
+ "description": "(Optional) The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) for any time in the last 7 days that you want to restore to. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp \u003cdeployment name or CRN\u003e). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr",
"source": [
"ibm_database.postgresql_db.point_in_time_recovery_time"
],
diff --git a/tests/other_test.go b/tests/other_test.go
index 6332bf0b..088acb59 100644
--- a/tests/other_test.go
+++ b/tests/other_test.go
@@ -38,6 +38,7 @@ func TestRunPointInTimeRecoveryDBExample(t *testing.T) {
Region: fmt.Sprint(permanentResources["postgresqlPITRRegion"]),
TerraformVars: map[string]interface{}{
"pitr_id": permanentResources["postgresqlPITRCrn"],
+ "pitr_time": " ",
"pg_version": permanentResources["postgresqlPITRVersion"],
"members": "3", // Lock members to 3 as the permanent postgres instances has 3 members
},
diff --git a/variables.tf b/variables.tf
index 39cbb165..afc2e4db 100644
--- a/variables.tf
+++ b/variables.tf
@@ -277,6 +277,6 @@ variable "pitr_id" {
variable "pitr_time" {
type = string
- description = "(Optional) The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) that you want to restore to. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp ). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr"
+ description = "(Optional) The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) for any time in the last 7 days that you want to restore to. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp ). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr"
default = null
}