Skip to content

Commit f4574ef

Browse files
committed
Add urlencode for the db password
1 parent 0f506ea commit f4574ef

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

examples/simple/main.tf

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module "materialize_infrastructure" {
3737
enable_bucket_encryption = false
3838

3939
# Database Configuration
40-
database_password = var.database_password
40+
database_password = random_password.pass.result
4141
postgres_version = "15"
4242
db_instance_class = "db.t3.large"
4343
db_allocated_storage = 20
@@ -63,6 +63,11 @@ module "materialize_infrastructure" {
6363
}
6464
}
6565

66+
resource "random_password" "pass" {
67+
length = 20
68+
special = false
69+
}
70+
6671
variable "namespace" {
6772
description = "Namespace for the resources. Used to prefix the names of the resources"
6873
type = string
@@ -75,13 +80,6 @@ variable "environment" {
7580
default = "dev"
7681
}
7782

78-
variable "database_password" {
79-
description = "Password for the database (should be provided via tfvars or environment variable)"
80-
default = "your-secure-password"
81-
type = string
82-
sensitive = true
83-
}
84-
8583
variable "materialize_instances" {
8684
description = "List of Materialize instances to be created."
8785
type = list(object({

examples/simple/terraform.tfvars.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace = "mz-self-mngd" // maximum 12 characters, starts with a letter, lowercase alphanumeric and hyphens
22
environment = "dev" // maximum 8 characters, lowercase alphanumeric only (e.g., dev, test)
3-
database_password = "your-secret-password"
43

54
# Once the operator is installed, you can define your Materialize instances here.
65
# Uncomment the following block (or provide your own instances) to configure them:

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ locals {
153153
metadata_backend_url = format(
154154
"postgres://%s:%s@%s/%s?sslmode=require",
155155
var.database_username,
156-
var.database_password,
156+
urlencode(var.database_password),
157157
module.database.db_instance_endpoint,
158158
coalesce(instance.database_name, instance.name)
159159
)

0 commit comments

Comments
 (0)