This example shows how to maintain service instance configuration in dedicated JSON files, apart from the development/deployment YAML.
The content of those files gets merged with the additional configurations defined in the mta(d).yaml and gets used as service instance creation/update parameters.
Service instances are modeled as MTA resources of type org.cloudfoundry.managed-service. The parameters used for their creation and update can be specified in two places:
-
In the
configparameter of the resource -
In an external
.jsonfile, referenced in thepathparameter of the resource
resources:
- name: my-service-instance
type: org.cloudfoundry.managed-service
parameters:
path: config.json #The content of the JSON will be taken as a base
config: #Those configurations will be merged in the config.json content
xsappname: "appname-with-suffix-${org}${space}"
#...|
Note
|
The content from the external file and config parameter are merged. In case of conflict during merging, the config parameter content will overwrite the other.
|
The example demonstrates 2 different approaches that lead to the same result. NOTE: Please adjust the service label, plan and parameter values to match the ones available in your environment
This approach uses deployment descriptor mtad.yaml and ready application binaries appBits.zip:
$ cf deploy ./ -f ;Alternatively, you can assemble an MTA archive, using the mtad.yaml file first:
$ mbt assemble -t ./ ;And then deploy the assembled archive:
$ cf deploy my-mta_0.0.0.mtar ;|
Note
|
See mtad.yaml for the modeling. |
This approach uses development descriptor mta.yaml and application binaries appBits.zip to build an MTAR archive:
$ mbt build -p cf -t . ;The MTAR archive is then deployed:
$ cf deploy a.cf.app_0.0.0.mtar -f ;|
Note
|
See mta.yaml for the concrete modeling. |
$ cf services
Getting services in org deploy-service / space ****** as ******...
name service plan
my-service-instance xsuaa application
my-user-provided-service-instance user-provided$ cf curl /v2/user_provided_service_instances/$(cf service my-user-provided-service-instance --guid)
{
...,
"entity": {
"name": "my-user-provided-service-instance",
"credentials": {
"tenant-mode": "dedicated",
"xsappname": "appname-with-suffix-deploy-service********"
},
...Notice that the user-provided service has the properly merged content in the credentials field.