Skip to content

Commit 72ca32a

Browse files
authored
Merge branch 'ryvn-mango:main' into main
2 parents adbcba6 + 0972bdc commit 72ca32a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ For a ready-to-use PostgreSQL connection URI (includes the password; username, p
5151
terraform output -raw db_connection_uri
5252
```
5353

54+
If you prefer a URI that references an environment variable for the password (literal `$(DB_PASSWORD)` placeholder):
55+
56+
```
57+
terraform output -raw db_connection_uri_with_env_password
58+
```
59+
5460
## Requirements
5561

5662
- Terraform >= 1.0.0
@@ -113,6 +119,7 @@ terraform output -raw db_connection_uri
113119
| db_security_group_id | The security group ID |
114120
| db_master_password | The master password you provided (sensitive) |
115121
| db_connection_uri | PostgreSQL connection URI with credentials (sensitive) |
122+
| db_connection_uri_with_env_password | PostgreSQL URI using $(DB_PASSWORD) placeholder |
116123

117124
## Security Considerations
118125

outputs.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,14 @@ output "db_connection_uri" {
4646
)
4747
sensitive = true
4848
}
49+
50+
output "db_connection_uri_with_env_password" {
51+
description = "PostgreSQL connection URI using $(DB_PASSWORD) placeholder"
52+
value = format(
53+
"postgresql://%s:$(DB_PASSWORD)@%s:%d/%s",
54+
urlencode(var.username),
55+
aws_db_instance.this.address,
56+
aws_db_instance.this.port,
57+
urlencode(var.database_name),
58+
)
59+
}

0 commit comments

Comments
 (0)