ibm-cloudibm-watsonwatson-discovery

How Can I bind different Watson Discovery to each CF application


I am creating CF application with one Resource group, one CF org, one Space.

I bound different Watson Discovery to each CF application.

When I get an error saying

 "Error response from the server. Status code: 400; description: 400 Code: BXNIM0150E, Message: The service name part of the provided CRNs must be unique, Details: Service name 'discovery' must be unique for all provided CRNs."

Specifically, The first bind(A_0001_APP) seems to be working fine but the second bind(D_0001_APP) not working as desired.

Is this the right approach?

Any help will be appreciated.

Here is a simplified log.

####################################################################################
# Bind to A_0001_APP -> That is absolutely fine.
####################################################################################
$ ibmcloud target
API endpoint:      https://api.au-syd.bluemix.net
Region:            au-syd
User:              *************************
Account:           *************************
Resource group:    d_resource01
CF API endpoint:   https://api.au-syd.bluemix.net (API version: 2.106.0)
Org:               d_org01
Space:             dev


$ ibmcloud cf push A_0001_APP
.....


$ ibmcloud resource service-instance-create A_0001_DISCOVERY discovery advanced jp-tok
Creating service instance A_0001_DISCOVERY in resource group d_resource01 of account *************************
OK
Service instance A_0001_DISCOVERY was created.
Name               Location   State      Type               Tags
A_0001_DISCOVERY   jp-tok     inactive   service_instance


$ ibmcloud resource service-key-create A_0001_DISCOVERY_CREDENTIAL Manager --instance-name A_0001_DISCOVERY
Creating service key of service instance A_0001_DISCOVERY under account *************************.
OK
Service key crn:v1:bluemix:public:discovery:jp-tok:a/*************************:resource-key:************************* was created.
Name:          A_0001_DISCOVERY_CREDENTIAL
ID:            crn:v1:bluemix:public:discovery:jp-tok:a/*************************:*************************:resource-key:*************************
Created At:    Mon Nov 19 07:57:03 UTC 2018
State:         active
Credentials:   .......

$ ibmcloud resource service-alias-create A_0001_DISCOVERY_ALIAS --instance-name A_0001_DISCOVERY
Creating alias A_0001_DISCOVERY_ALIAS of service instance A_0001_DISCOVERY from resource group d_resource01 into space dev...
OK
Service alias A_0001_DISCOVERY_ALIAS was successfully created.

ID:                 crn:v1:bluemix:public:discovery:au-syd:a//*************************::/*************************::resource-alias:/*************************:
Name:               A_0001_DISCOVERY_ALIAS
State               active
Service Instance:   A_0001_DISCOVERY
Space:              dev
Tags:
Parameters:

$ ibmcloud resource service-binding-create A_0001_DISCOVERY_ALIAS A_0001_APP Manager --service-id my_service
Binding service alias A_0001_DISCOVERY_ALIAS to app A_0001_APP in space dev...
OK
Service binding crn:v1:bluemix:public:discovery:au-syd:a/:*************************:resource-binding::************************* was created.


####################################################################################
# Bind to D_0001_APP -> I can't create service-binding.
####################################################################################
$ ibmcloud target
API endpoint:      https://api.au-syd.bluemix.net
Region:            au-syd
User:              *************************
Account:           *************************
Resource group:    d_resource01
CF API endpoint:   https://api.au-syd.bluemix.net (API version: 2.106.0)
Org:               d_org01
Space:             dev

$ ibmcloud cf push D_0001_APP
.....

$ ibmcloud resource service-instance-create D_0001_DISCOVERY discovery advanced jp-tok
Creating service instance D_0001_DISCOVERY in resource group d_resource01 of account *************************
OK
Service instance D_0001_DISCOVERY was created.
Name               Location   State      Type               Tags
D_0001_DISCOVERY   jp-tok     inactive   service_instance

$ ibmcloud resource service-key-create D_0001_DISCOVERY_CREDENTIAL Manager --instance-name D_0001_DISCOVERY
Creating service key of service instance D_0001_DISCOVERY under account *************************.
OK
Service key crn:v1:bluemix:public:discovery:jp-tok:a/*************************:resource-key:************************* was created.
Name:          D_0001_DISCOVERY_CREDENTIAL
ID:            crn:v1:bluemix:public:discovery:jp-tok:a/*************************:*************************:resource-key:*************************
Created At:    Tue Nov 20 10:12:56 UTC 2018
State:         active
Credentials:    .......

$ ibmcloud resource service-alias-create D_0001_DISCOVERY_ALIAS --instance-name D_0001_DISCOVERY
Creating alias D_0001_DISCOVERY_ALIAS of service instance D_0001_DISCOVERY from resource group d_resource01 into space dev...
OK
Service alias D_0001_DISCOVERY_ALIAS was successfully created.
ID:                 crn:v1:bluemix:public:discovery:au-syd:a//*************************::/*************************::resource-alias:/*************************:
Name:               D_0001_DISCOVERY_ALIAS
State               active
Service Instance:   D_0001_DISCOVERY
Space:              dev
Tags:
Parameters:

$ ibmcloud resource service-binding-create D_0001_DISCOVERY_ALIAS D_0001_APP Manager --service-id my_service
Binding service alias D_0001_DISCOVERY_ALIAS to app D_0001_APP in space dev...
FAILED
Error response from the server. Status code: 400; description: 400 Code: BXNIM0150E, Message: The service name part of the provided CRNs must be unique, Details: Service name 'discovery' must be unique for all provided CRNs.
script returned exit code 1

Solution

  • As mentioned in the error, the service name part of the CRN (Cloud Resource Name) must be unique.

    The base canonical format of a CRN is:

    crn:version:cname:ctype:service-name:location:scope:service-instance:resource-type:resource
    

    The service-name segment uniquely identifies a capability (service, component, product) being offered by the cloud. The capability can be a user provided service such as with the services that are listed in the IBM Cloud catalog, or an internal architectural component critical to the IBM Cloud functionality.

    The service-name indicates the service that the resource belongs to, and IBM Cloud enforces global uniqueness of service names. The service-name must be alphanumeric, lowercase, no spaces or special characters other than '-'.

    Yes. I am able to reproduce the issue with unique alias names and what worked for me is a different service-id

    ibmcloud resource service-binding-create D_0001_DISCOVERY_ALIAS D_0001_APP Manager --service-id myserviceID