Create a password variable for a Vultr Marketplace app using the Vultr Console or Vultr API to generate random credentials for each customer deployment.
A password variable generates a unique password automatically at each deployment, rather than prompting the customer to supply one. Like a user-supplied variable, the Marketplace can display it in your application instructions and expose its value to your application through the Vultr Metadata API.
This guide explains how to create a password variable using the Vultr Console or the Vultr API.
Click Marketplace in the Vultr Console's left-hand menu.
Click the application name to open the Edit App screen.
Click the Variables tab.
Under Add New Variable, enter the following information.
Under Length, enter the length of the password to generate at each deployment. It must be between 8 and 50 characters.
Click Add New Variable.
Verify that the new variable appears in the Variables list.
Send a POST request to the Create Marketplace App Variable endpoint. Replace {app-id} with the app's ID and VARIABLE-NAME/VARIABLE-LABEL with your values. Set password_length between 8 and 50.
$ curl "https://api.vultr.com/v2/marketplace/apps/{app-id}/manage-variables" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "VARIABLE-NAME",
"label": "VARIABLE-LABEL",
"type": "password",
"password_length": 16
}'
The response contains the new app_variable object, including its id.