# Plugin parameterization

> How Cloud Management Platform (CMP) turns template variables in plugin code into action inputs

---

Site [llms.txt](/llms.txt)

---

When you upload a plugin file or point at one by URL, CMP scans its contents for template variables such as `{{ variable }}` and creates an action input for each one it finds. See [Action input parameters](/docs/cmp/use/orchestration/actions/action-input-parameters/) for more on generated inputs, and [Action context](/docs/cmp/use/orchestration/actions/action-context/) for the objects available in each context.

CMP prompts users for those inputs and renders them into the action before it runs. Input values are escaped so they cannot execute arbitrary code while still rendering as expected.

<div class="alert alert-warning" role="alert">


Escaping only protects you if the variable is quoted correctly in your code. Always surround a string input with quote marks, as in `hostname = "{{ server.hostname }}"`. Without them, a user could type Python code into an action input, and it would run as though the plugin author had written it.
</div>


## File upload inputs

An action input can be of type **File Upload**, allowing users to pick a file when they run the action. It is supported for plugins used as blueprint build items, resource actions, and server actions. Use it to let someone choose a file to push to an S3 bucket, or onto a server being provisioned as part of a blueprint deployment.

CMP uploads the file to the appliance as part of the ordering process. What happens to it after that is up to your plugin code.

This sample shows how to resolve the uploaded file's path and confirm it arrived:

```python
from django.conf import settings
from os import path
from common.methods import set_progress


def run(job, blueprint_context, **kwargs):
    file = "{{ file }}"
    if file.startswith(settings.MEDIA_URL):
        set_progress("Converting relative URL to filesystem path")
        file_full_path = file.replace(settings.MEDIA_URL, settings.MEDIA_ROOT)
    else:
        file_full_path = f"{settings.MEDIA_ROOT}{file}"
    set_progress(f"File full path is: {file_full_path}")
    if path.exists(file_full_path):
        return "SUCCESS", "File upload successful!", ""
    else:
        return "FAILURE", "The file was not uploaded!", ""
```

After adding the plugin, edit the generated action input and change its type to **File Upload**.

## Related

- [Action input parameters](/docs/cmp/use/orchestration/actions/action-input-parameters/)
- [Action context](/docs/cmp/use/orchestration/actions/action-context/)
- [Structure of a plugin](/docs/cmp/use/orchestration/plugins/structure/)
