Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ To attach access management tags to resources in this module, you need the follo
| <a name="input_name"></a> [name](#input\_name) | The name to give the Postgresql instance. | `string` | n/a | yes |
| <a name="input_pg_version"></a> [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 |
| <a name="input_pitr_id"></a> [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 |
| <a name="input_pitr_time"></a> [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 <deployment name or CRN>). 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 |
| <a name="input_pitr_time"></a> [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 <deployment name or CRN>). 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 |
| <a name="input_plan_validation"></a> [plan\_validation](#input\_plan\_validation) | Enable or disable validating the database parameters for PostgreSQL during the plan phase. | `bool` | `true` | no |
| <a name="input_region"></a> [region](#input\_region) | The region where you want to deploy your instance. | `string` | `"us-south"` | no |
| <a name="input_remote_leader_crn"></a> [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 |
Expand Down
6 changes: 1 addition & 5 deletions examples/pitr/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "../.."
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion examples/pitr/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 5 additions & 0 deletions examples/pitr/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 <deployment name or CRN>). 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."
Expand Down
2 changes: 1 addition & 1 deletion module-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
1 change: 1 addition & 0 deletions tests/other_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 <deployment name or CRN>). 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 <deployment name or CRN>). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pitr"
default = null
}