Pass sensitive values during MTA deployment by creating or using a persistent user-provided service instance.
When you need to use sensitive values during MTA deployment, you can use a persistent user-provided service instance to manage the encryption key. In this approach, you are responsible for creating, maintaining, and deleting the Cloud Foundry user-provided service instance that holds the encryption key used to secure your data during deployment. If the instance doesn't exist when you start the deployment, it is created automatically and holds a randomly generated encryption key. However, you remain responsible for managing the service instance throughout its lifecycle, including updating the encryption key if needed and deleting the instance when it's no longer required. The whole process is visualized in the diagram below and the actual step-by-step procedure that you have to follow is available in the next section.
This image is interactive. Hover over the circles for more information.
-
Declare environment variables locally that will store your sensitive values. These environment values must follow the naming conventions described in Environment Variables and User-Provided Service Instance Specifics.
__MTA___configSecret="confidentialInformation" -
Reference the environment variable in your deployment or extension descriptor.
_schema-version: "3.1" ID: example-services.extension extends: example-services modules: - name: myApp type: staticfile path: content/archive.zip parameters: app-name: example-app memory: 299M disk-quota: 107M requires: - name: my-resource parameters: config: importantParameter: ${configSecret} resources: - name: my-resource type: org.cloudfoundry.managed-service parameters: service: workflow service-plan: standard service-name: my-resource-name -
Create a user-provided service instance that holds a 32-character-long encryption key in your Cloud Foundry space. The name of the user-provided service instance must follow the naming conventions described in Environment Variables and User-Provided Service Instance Specifics.
cf cups __mta-secure-<mtaId> -p '{"encryptionKey": "abdfgtresghytiothewqprtimgnhdrwp"}'For more information, see Creating User-Provided Service Instances.
If the user-provided service instance is not present before the deployment, it will be created automatically and you will be responsible for its management and deletion at the end of the deployment operation.
-
Start a deployment by adding the
--require-secure-parametersflag to thecf deploycommand.cf deploy ./ -f -e extension.mtaext,extension-after.mtaext --require-secure-parameters -
**(Recommended)**After the deployment finishes, you can delete the user-provided service instance.
The values of the parameters referencing the configSecret environment variable are replaced with the actual sensitive value during the MTA deployment.
Related Information
Sensitive Data Handling During MTA Deployment
Environment Variables and User-Provided Service Instance Specifics
