cnabio / cnab-spec

Cloud Native Application Bundle Specification
https://cnab.io
Other
950 stars 100 forks source link

Define a parameter source from a dependency output #385

Open carolynvs opened 3 years ago

carolynvs commented 3 years ago

Porter has the concept of a parameter source that is populated from dependency output. For example:

The wordpress bundle has a dependencies custom section that requires the mysql bundle. The mysql bundle generates a connstr output representing the connection string to the database. The parameter source dependencies.output allows the wordpress bundle to inject the connstr output from mysql to one of its parameters so that it can use the connection string created by the mysql bundle.

{
    "custom": {
        "io.cnab.dependencies": {
            "requires": {
                "mysql": {
                    "bundle": "mysql:v0.5.7"
                }
            }
        },
        "io.cnab.parameter-sources": {
            "porter-connstr": {
                "priority": [
                    "dependencies.output"
                ],
                "sources": {
                    "dependencies.output": {
                        "dependency": "mysql",
                        "name": "connstr"
                    }
                }
            }
        }
    }
}

This seems useful to have in the CNAB spec for parameter sources. So that if a bundle has a dependency defined, the author can choose to default a parameter using a dependency output and have it supported across tools.