Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add parameters for service in Cloud Foundry manifest

I would like to push a Cloud Foundry app that needs to bind to a service that requires additional parameters. I found docs on binding services with arbitrary parameters using cf bind-service at the command line, and I've seen elsewhere how to do a simple binding using a manifest.yml file. However, I don't see how to add arbitrary parameters for a service binding in a manifest file. How can that be done?

The bind-service approach is done as:

cf bind-service APP_NAME SERVICE_INSTANCE -c '{"role":"read-only"}'

But I'd like to be able to do it in the manifest, something like the hypothetical below (but which doesn't work):

services:
 - service_instance:
     role: read-only
like image 285
Scott H Avatar asked Feb 02 '17 19:02

Scott H


2 Answers

I'd like to give an update on this old question as I've just bumped on the same issue and the answer nowadays is different. Things have evolved and using cf CLI V7 we are now able to pass in parameters for services within manifest files. Here is the syntax:

--- 
applications: 
- name: my-app
  services:
  - name: my-service1
    parameters: 
      foo: bar
      herp: derp
  - name: my-service2
    parameters: 
      foo: bar

and below is a real example:

---
applications:
  - name: order-service
    path: order-service/build/libs/order-service-0.0.1.jar
    services:
      - mysql
      - name: gateway
        parameters:
          routes: [{"path": "/order-service/**"}]
like image 137
dbaltor Avatar answered Oct 21 '22 09:10

dbaltor


The documentation on Cloud Foundry application binding states that arbitrary parameters are not currently supported in manifests:

As an alternative to binding a service instance after pushing an application, you can use the application manifest to bind the service instance during push. As of cf CLI v6.12.1, Arbitrary Parameters are not supported in application manifests.

like image 4
Scott H Avatar answered Oct 21 '22 09:10

Scott H