terraform-ibm-modules/terraform-ibm-icd-mysql

Data block "ibm_database_connection" does not take "public-and-private" as endpoint type

Closed this issue · 2 comments

This data block

data "ibm_database_connection" "database_connection" {

only take values public and private as endpoint type, which is creating an issue when passing public-and-private by direclty passing this variable value as public-and-private as it is an allowed value in variable constraints.

variable "service_endpoints" {

Should we have some conditional check on the data block endpoint_type based on the service_endpoints as it supportspublic, private and public-and-private or should we create another variable for endpoint_type?

@Ak-sky I suggest use logic like this instead:

data "ibm_database_connection" "database_connection" {
  endpoint_type = var.service_endpoints == "public-and-private" ? "public" : "private"
  deployment_id = ibm_database.mysql_db.id
  user_id       = ibm_database.mysql_db.adminuser
  user_type     = "database"
}