Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Expression to bring in file as a string - use case: Deployment Scripts/UserData #1624

Closed
JustinGrote opened this issue Feb 25, 2021 · 2 comments
Labels
enhancement New feature or request Needs: Triage 🔍

Comments

@JustinGrote
Copy link

JustinGrote commented Feb 25, 2021

Is your feature request related to a problem? Please describe.
I have a powershell .ps1 script that I want to use to do some advanced calculations and return some outputs (subnet math). Currently I have to embed the script in the arm template with ScriptContent or awkwardly place it on a github script URI which makes it less portable and more difficult to locally test changes.

Ideally I could keep the .ps1 as a separate file (so I can unit test it with pester and whatnot) and then at bicep compilation pull it in as a string to ScriptContent. Currently I am doing this with a separate powershell step after the bicep compilation but it would be nice to have it native in the bicep template.

Describe the solution you'd like
To keep this generic, a bicep expression that will read a file and output it as a string. That way it could be used outside of just deploymentscripts, basically a cat operator though the name maybe should be file or something, I'll leave to the team to decide.

Concerns

  1. Should expressions in the file be preserved or escaped? Since Powershell often uses ${} syntax. I say escaped and you can sub in expressions with the format operator if you need to (maybe)? Maybe an operator true/false parameter? EDIT: For Powershell at least, expressions can be replaced by using the arguments parameter, but something like UserData may still need a way to substitute in expressions.
@JustinGrote JustinGrote added the enhancement New feature or request label Feb 25, 2021
@ghost ghost added the Needs: Triage 🔍 label Feb 25, 2021
@alex-frankel
Copy link
Collaborator

Closing since we are tracking this with #471. I think we will get to this in 0.4.

@JustinGrote
Copy link
Author

@alex-frankel whoops, I swear I did a due diligence search. Agreed.

@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests

2 participants