Skip to content

Commit 3e6cfab

Browse files
committed
Connection and credential variables validated for empty strings
In variables for DB system connections, it´s validated whether usernames, passwords, hosts, service names, and agent IDs are provided in JSON-input as empty strings. This is to stop apply early before anything is actually created in OCI Port and protocol variable definitions have not been changed since the former has a default value and the latter has alternative validation
1 parent 1203619 commit 3e6cfab

File tree

2 files changed

+32
-0
lines changed
  • manageability-and-operations/observability-and-manageability/external-database-enablement/root_module/modules

2 files changed

+32
-0
lines changed

manageability-and-operations/observability-and-manageability/external-database-enablement/root_module/modules/container/container_connection/variables.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ variable "compartment_ocid" {
77
variable "external_database_connector_connection_string_hostname" {
88
description = "Hostname for connection string"
99
type = string
10+
validation {
11+
condition = var.external_database_connector_connection_string_hostname != ""
12+
error_message = "The value of 'host' in the JSON-input for database systems is an empty string"
13+
}
1014
}
1115

1216
variable "external_database_connector_connection_string_port" {
@@ -33,6 +37,10 @@ variable "ssl_secret_id" {
3337
variable "external_database_connector_agent_id" {
3438
description = "The OCID for the management agent used for database connections"
3539
type = string
40+
validation {
41+
condition = var.external_database_connector_agent_id != ""
42+
error_message = "The value of 'managementAgentId' in the JSON-input for database systems is an empty string"
43+
}
3644
#default = "ocid1.managementagent.oc1..XXXXXXX"
3745
}
3846

@@ -64,6 +72,10 @@ variable "external_cdb_connector_connection_credentials_credential_type" {
6472
variable "external_cdb_connector_connection_credentials_password" {
6573
description = "Password for container database connector"
6674
type = string
75+
validation {
76+
condition = var.external_cdb_connector_connection_credentials_password != ""
77+
error_message = "Container database connector password is an empty string. Confirm values in the JSON-input for credentials"
78+
}
6779
}
6880

6981
variable "external_cdb_connector_connection_credentials_role" {
@@ -78,9 +90,17 @@ variable "external_cdb_connector_connection_credentials_role" {
7890
variable "external_cdb_connector_connection_credentials_username" {
7991
description = "Username for container database connector"
8092
type = string
93+
validation {
94+
condition = var.external_cdb_connector_connection_credentials_username != ""
95+
error_message = "Container database connector username is an empty string. Confirm values in the JSON-input for credentials"
96+
}
8197
}
8298

8399
variable "external_cdb_connector_connection_string_service" {
84100
description = "Service name for container database connector"
85101
type = string
102+
validation {
103+
condition = var.external_cdb_connector_connection_string_service != ""
104+
error_message = "The value of 'containerServiceName' in the JSON-input for database systems is an empty string"
105+
}
86106
}

manageability-and-operations/observability-and-manageability/external-database-enablement/root_module/modules/pdb/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ variable "external_pdb_connector_connection_credentials_credential_type" {
6969
variable "external_pdb_connector_connection_credentials_password" {
7070
description = "Password for pluggable database connector"
7171
type = string
72+
validation {
73+
condition = var.external_pdb_connector_connection_credentials_password != ""
74+
error_message = "Pluggable database connector password is an empty string. Confirm values in the JSON-input for credentials"
75+
}
7276
}
7377

7478
variable "external_pdb_connector_connection_credentials_role" {
@@ -83,11 +87,19 @@ variable "external_pdb_connector_connection_credentials_role" {
8387
variable "external_pdb_connector_connection_credentials_username" {
8488
description = "Username for pluggable database connector"
8589
type = string
90+
validation {
91+
condition = var.external_pdb_connector_connection_credentials_username != ""
92+
error_message = "Pluggable database connector username is an empty string. Confirm values in the JSON-input for credentials"
93+
}
8694
}
8795

8896
variable "external_pdb_connector_connection_string_service" {
8997
description = "Service name for pluggable database connector"
9098
type = string
99+
validation {
100+
condition = var.external_pdb_connector_connection_string_service != ""
101+
error_message = "The value of 'pdbServiceName' in the JSON-input for database systems is an empty string"
102+
}
91103
}
92104

93105
variable "enable_database_management_pdb" {

0 commit comments

Comments
 (0)