Problem description
I create a user via terraform for our postgres DB.
resource "stackit_postgresflex_user" "user" {
project_id = var.project_id
instance_id = stackit_postgresflex_instance.main.instance_id
username = "project_${var.environment}_user"
roles = ["login"]
}
The resource expose some important outputs:
stackit_postgresflex_user.user.uri
stackit_postgresflex_user.user.password
To get access to the password:
- They are not readable in the portal and so I can only recreate a new password in the portal to see it.
- I export it with terraform apply
Proposed solution
# ALREADY EXISTING:
resource "stackit_secretsmanager_instance" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-instance"
acls = ["XXX.XXX.XXX.X/XX", "XX.XXX.XX.X/XX"]
}
resource "stackit_secretsmanager_secret" "database_uri" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = stackit_secretsmanager_instance.example.instance_id
name = "our database credentials"
secrets = {
db_uri = stackit_postgresflex_user.user.uri
}
}
Problem description
I create a user via terraform for our postgres DB.
The resource expose some important outputs:
stackit_postgresflex_user.user.uristackit_postgresflex_user.user.passwordTo get access to the password:
Proposed solution