Connection Resource
About
The Connection resource let's you store pre-configured inputs for a Task. This is commonly used to store connection information to a remote system. Connections can also be associated with a Vault secret. You can use stored connections in flows to connect to remote systems with more comfort.
Simple example
Create a connection for the GIT task type and call it "library". Enter the following into the value field:
ref: developcommand: metadatarepository_url: 'https://github.com/starflows/library.git'
Next, create a new flow to use the connection and call it "connection-test". Use the following script:
import flow_apidef handler(system: flow_api.System, this: flow_api.Execution):metadata = this.connect('library').get('output_value')this.log(metadata['date_str'])return this.success('all done')
Override inputs
You can override inputs which are stored in the connection by specifying different values when using the connection. Let's modify the "connection-test" flow from before to read information for a different ref
:
import flow_apidef handler(system: flow_api.System, this: flow_api.Execution):metadata = this.connect('library', ref='v2').get('output_value')this.log(metadata['date_str'])return this.success('all done')
Attach Vault Secrets
To be able to attach secrets to a connection object, a working vault integration must be configured beforehand.
Please refer to Vault Integration for details.
Order of Input Application
Inputs for a task execution can be specified in different places. Inputs from all places are merged into one combined input set before being used by the task. Inputs are applied in the following order:
- Value of the connection
- Vault secrets associated with the connection
- Inputs specified in the flow script
Inputs which are applied later can override keys of inputs which were applied before. If, for example, the connection specifies a key port
and the vault secret also contains a key port
, the value of the vault secret will be used.