Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DB_ environment variables to work around issue reading VCAP_SERVICES #905

Merged
merged 1 commit into from
Oct 7, 2024
Merged
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
24 changes: 3 additions & 21 deletions terraform/modules/csb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@ data "cloudfoundry_space" "services" {
org_name = var.org_name
}

resource "cloudfoundry_user_provided_service" "db" {
name = "csb-db"
space = data.cloudfoundry_space.services.id
credentials = {
"db_name" = var.rds_name
"host" = var.rds_host
"name" = var.rds_name
"password" = var.rds_password
"port" = var.rds_port
"uri" = var.rds_url
"username" = var.rds_username
}
# Required so the broker can find this entry in VCAP_SERVICES.
# https://github.com/cloudfoundry/cloud-service-broker/blob/d1a7c753ed878b4d3828f1db73dfcceed2f9bdce/dbservice/vcap.go#L104
tags = ["mysql"]
}

resource "random_password" "csb_app_password" {
length = 32
special = false
Expand All @@ -44,12 +27,11 @@ resource "cloudfoundry_app" "csb" {
memory = 1 * 1024 # 1GB
disk_quota = 7 * 1024 # 7GB

service_binding {
service_instance = cloudfoundry_user_provided_service.db.id
}

environment = {
# General broker configuration
DB_HOST = var.rds_host
DB_USERNAME = var.rds_name
DB_PASSWORD = var.rds_password
SECURITY_USER_NAME = "broker"
SECURITY_USER_PASSWORD = random_password.csb_app_password.result
TERRAFORM_UPGRADES_ENABLED = true
Expand Down