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
4 changes: 2 additions & 2 deletions examples/backup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "postgresql_db" {
source = "../.."
resource_group_id = module.resource_group.resource_group_id
name = "${var.prefix}-postgres"
postgresql_version = var.pg_version
postgresql_version = var.postgresql_version
region = var.region
tags = var.resource_tags
access_tags = var.access_tags
Expand All @@ -35,7 +35,7 @@ module "restored_icd_postgresql" {
# version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
resource_group_id = module.resource_group.resource_group_id
name = "${var.prefix}-postgres-restored"
postgresql_version = var.pg_version
postgresql_version = var.postgresql_version
region = var.region
tags = var.resource_tags
access_tags = var.access_tags
Expand Down
2 changes: 1 addition & 1 deletion examples/backup/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ variable "prefix" {
description = "Prefix to append to all resources created by this example"
}

variable "pg_version" {
variable "postgresql_version" {
description = "Version of the postgresql instance. If no value passed, the current ICD preferred version is used."
type = string
default = null
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module "icd_postgresql" {
resource_group_id = module.resource_group.resource_group_id
name = "${var.prefix}-postgres"
region = var.region
postgresql_version = var.pg_version
postgresql_version = var.postgresql_version
admin_pass = var.admin_pass
users = var.users
# Example of how to use different KMS keys for data and backups
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ variable "access_tags" {
default = []
}

variable "pg_version" {
variable "postgresql_version" {
description = "Version of the PostgreSQL instance. If no value is passed, the current preferred version of IBM Cloud Databases is used."
type = string
default = null
Expand Down
2 changes: 1 addition & 1 deletion examples/fscloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module "postgresql_db" {
resource_group_id = module.resource_group.resource_group_id
name = "${var.prefix}-postgres"
region = var.region
pg_version = var.pg_version
postgresql_version = var.postgresql_version
kms_key_crn = var.kms_key_crn
backup_encryption_key_crn = var.backup_encryption_key_crn
backup_crn = var.backup_crn
Expand Down
2 changes: 1 addition & 1 deletion examples/fscloud/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ variable "access_tags" {
default = []
}

variable "pg_version" {
variable "postgresql_version" {
description = "Version of the PostgreSQL instance. If no value is passed, the current preferred version of IBM Cloud Databases is used."
type = string
default = null
Expand Down
2 changes: 1 addition & 1 deletion examples/pitr/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module "postgresql_db_pitr" {
cpu_count = 0
member_host_flavor = "multitenant"
members = var.members
postgresql_version = var.pg_version
postgresql_version = var.postgresql_version
pitr_id = var.pitr_id
pitr_time = var.pitr_time
}
2 changes: 1 addition & 1 deletion examples/pitr/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ variable "resource_group" {
default = null
}

variable "pg_version" {
variable "postgresql_version" {
description = "Version of the postgresql instance. If no value passed, the current ICD preferred version is used."
type = string
default = null
Expand Down
2 changes: 1 addition & 1 deletion modules/fscloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ No resources.
| <a name="input_member_memory_mb"></a> [member\_memory\_mb](#input\_member\_memory\_mb) | Allocated memory per member. [Learn more](https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-resources-scaling) | `number` | `4096` | no |
| <a name="input_members"></a> [members](#input\_members) | Allocated number of members. Members can be scaled up but not down. | `number` | `2` | no |
| <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. If no value is passed, the current preferred version of IBM Cloud Databases is used. | `string` | `null` | no |
| <a name="input_postgresql_version"></a> [postgresql\_version](#input\_postgresql\_version) | Version of the PostgreSQL instance. If no value is passed, the current preferred version of IBM Cloud Databases is used. | `string` | `null` | no |
| <a name="input_region"></a> [region](#input\_region) | The region where you want to deploy your instance. Must be the same region as the Hyper Protect Crypto Services 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 |
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the PostgreSQL instance will be created. | `string` | n/a | yes |
Expand Down
2 changes: 1 addition & 1 deletion modules/fscloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module "postgresql_db" {
remote_leader_crn = var.remote_leader_crn
skip_iam_authorization_policy = var.skip_iam_authorization_policy
service_endpoints = "private"
postgresql_version = var.pg_version
postgresql_version = var.postgresql_version
use_ibm_owned_encryption_key = var.use_ibm_owned_encryption_key
use_same_kms_key_for_backups = var.use_same_kms_key_for_backups
use_default_backup_encryption_key = var.use_default_backup_encryption_key
Expand Down
2 changes: 1 addition & 1 deletion modules/fscloud/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ variable "name" {
description = "The name to give the Postgresql instance."
}

variable "pg_version" {
variable "postgresql_version" {
type = string
description = "Version of the PostgreSQL instance. If no value is passed, the current preferred version of IBM Cloud Databases is used."
default = null
Expand Down
14 changes: 7 additions & 7 deletions tests/other_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestRunRestoredDBExample(t *testing.T) {
BestRegionYAMLPath: regionSelectionPath,
ResourceGroup: resourceGroup,
TerraformVars: map[string]interface{}{
"pg_version": "13",
"postgresql_version": "13",
},
CloudInfoService: sharedInfoSvc,
})
Expand All @@ -39,10 +39,10 @@ func TestRunPointInTimeRecoveryDBExample(t *testing.T) {
ResourceGroup: resourceGroup,
Region: fmt.Sprint(permanentResources["postgresqlPITRRegion"]),
TerraformVars: map[string]interface{}{
"pitr_id": permanentResources["postgresqlPITRCrn"],
"pitr_time": "", // if blank string is passed, earliest_point_in_time_recovery_time will be used to restore
"pg_version": permanentResources["postgresqlPITRVersion"],
"members": "3", // Lock members to 3 as the permanent postgres instances has 3 members
"pitr_id": permanentResources["postgresqlPITRCrn"],
"pitr_time": "", // if blank string is passed, earliest_point_in_time_recovery_time will be used to restore
"postgresql_version": permanentResources["postgresqlPITRVersion"],
"members": "3", // Lock members to 3 as the permanent postgres instances has 3 members
},
CloudInfoService: sharedInfoSvc,
})
Expand All @@ -59,7 +59,7 @@ func testPlanICDVersions(t *testing.T, version string) {
Testing: t,
TerraformDir: "examples/basic",
TerraformVars: map[string]interface{}{
"pg_version": version,
"postgresql_version": version,
},
CloudInfoService: sharedInfoSvc,
})
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestRunCompleteExample(t *testing.T) {
BestRegionYAMLPath: regionSelectionPath,
ResourceGroup: resourceGroup,
TerraformVars: map[string]interface{}{
"pg_version": "13",
"postgresql_version": "13",
},
CloudInfoService: sharedInfoSvc,
})
Expand Down
39 changes: 22 additions & 17 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,30 +129,35 @@ func TestRunSecurityEnforcedSolutionSchematics(t *testing.T) {
assert.Nil(t, err, "This should not have errored")
}

func TestRunSecurityEnforcedUpgradeSolution(t *testing.T) {
func TestRunSecurityEnforcedUpgradeSolutionSchematics(t *testing.T) {
t.Parallel()

options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
Testing: t,
TerraformDir: fullyConfigurableSolutionTerraformDir,
Region: "us-south",
Prefix: "pg-fc-upg",
ResourceGroup: resourceGroup,
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Testing: t,
Region: "us-south",
Prefix: "pg-se-upg",
ResourceGroup: resourceGroup,
TarIncludePatterns: []string{
"*.tf",
fullyConfigurableSolutionTerraformDir + "/*.tf",
securityEnforcedSolutionTerraformDir + "/*.tf",
},
TemplateFolder: securityEnforcedSolutionTerraformDir,
Tags: []string{"pg-se-upg"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 120,
CheckApplyResultForUpgrade: true,
})

options.TerraformVars = map[string]interface{}{
"prefix": options.Prefix,
"access_tags": permanentResources["accessTags"],
"existing_kms_instance_crn": permanentResources["hpcs_south_crn"],
"existing_resource_group_name": resourceGroup,
options.TerraformVars = []testschematic.TestSchematicTerraformVar{
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
{Name: "prefix", Value: options.Prefix, DataType: "string"},
{Name: "existing_resource_group_name", Value: resourceGroup, DataType: "string"},
{Name: "existing_kms_instance_crn", Value: permanentResources["hpcs_south_crn"], DataType: "string"},
}

output, err := options.RunTestUpgrade()
if !options.UpgradeTestSkipped {
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
}
err := options.RunSchematicUpgradeTest()
assert.Nil(t, err, "This should not have errored")
}

func TestPlanValidation(t *testing.T) {
Expand Down