Give component user control for input / variable expansion behavior
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=525110) </details> <!--IssueSummary end--> > [!note] > Originated in https://gitlab.slack.com/archives/C06AQBJETRR/p1741706165927669 > which may or may not be available when you click this link. With the current feature set component authors can use [`expand_vars`](https://docs.gitlab.com/ci/yaml/inputs/#expand_vars) and with that "control" if an input should be taking literally or if it should expand variables when rendering. However, most often it's the component user that knows if the input value should be expanded or not. For example, in the OpenTofu CI/CD we currently [have a request](https://gitlab.com/components/opentofu/-/issues/119) that "all" inputs should make use of `expand_vars`. While this may desirable for some users it may not be for others who expect the input values to be taken literally (for example they want to delay the expansion to be done for their shell in the job). Currently, there is no way to support both use cases for a component author. There are related scenarios: 1. sending the variable name and use as it is (no expansion anywhere) 2. sending the variable name and expand_var (expansion in the component) 3. sending the variable value (not available yet) 4. sending the variable value and make it available as a variable in another name in the component (not available yet ([discussion](https://gitlab.com/groups/gitlab-org/-/epics/16321#note_2387966135))) ## Ideas for giving control to the component user Let a component user decide the expansion behavior per-input when they include the component: ```yaml include: - component: gitlab.com/components/opentofu@1.0 inputs: some_input: value: $MY_VAR expand_vars: true another_input: value: $ANOTHER_VAR # literal interpolation ``` Another option could be to support "functions" outside of components (this would probably be more involved): ```yaml include: - component: gitlab.com/components/opentofu@1.0 inputs: some_input: value: $[[ $MY_VAR | expand_vars ]] another_input: value: $ANOTHER_VAR # literal interpolation ```
issue