Creates a read only copy of an existing IBM Cloud Databases resource.

Configuration of an ICD data_source requires that the region parameter is set for the IBM provider in the to be the same as the ICD service location/region that the service will be deployed in. If not specified it will default to us-south. A terraform refresh of the data_source will fail if the ICD location is different to that specified on the provider.

Example Usage

data "ibm_database" "<your_database>" {
  name = "<your_database>"
  location = "<your-db-location>"

Argument Reference

The following arguments are required:

  • name - (Required, string) The name used to identify the IBM Cloud Database instance in the IBM Cloud UI. IBM Cloud does not enforce that service names are unique and it is possible that duplicate service names exist. The first located service instance is used by Terraform. The name must not include spaces.

  • resource_group_id - (Optional, string) The id of the resource group where the resource instance exists. If not provided it takes the default resource group.

  • location - (Optional, string) The location or the environment in which instance exists.

  • service - (Optional, string) The service type of the instance. You can retrieve the value by running the ibmcloud catalog service-marketplace or ibmcloud catalog search command in the IBM Cloud CLI.

Attribute Reference

The following attributes are exported:

  • id - The unique identifier of this ICD instance.
  • plan - The service plan for this ICD instance
  • location - The location or region for this ICD instance. This will be the same as defined for the provider or its alias.
  • status - Status of the ICD instance.
  • id - The unique identifier of the new database instance (CRN).
  • status - Status of resource instance.
  • adminuser - userid of the default admistration user for the database, usually admin or root.
  • version - Database version.
  • connectionstrings - List of connection strings by userid for the database. See the IBM Cloud documentation for more details of how to use connection strings in ICD for database access: The results are returned in pairs of the userid and string: = admin connectionstrings.1.string = postgres://admin:$
  • whitelist - List of whitelisted IP addresses or ranges.

Note that the provider only exports the admin userid and associated connectionstring. It does not export any userids additionally configured for the instance. This is due to a lack of ICD function.