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

How to prevent variable substitution #795

Closed
orbitalmedia opened this issue Apr 4, 2016 · 1 comment
Closed

How to prevent variable substitution #795

orbitalmedia opened this issue Apr 4, 2016 · 1 comment

Comments

@orbitalmedia
Copy link

Using this puppet code, my goal is to preserve the variable $upstream that is written to the config file. However it is always substituted for the actual value. The reason for the substitution is detailed here

$upstream = "http://acme.unix.local"
nginx::resource::vhost { 'acme.co':
listen_port => 8080,
server_name => [
'www.acme.co'
],
proxy => "$upstream",
}

This is intended ,
location / {
proxy_pass $upstream;
}

Unfortunately I am getting this result ,
location / {
proxy_pass http://acme.unix.local;
}

Any suggestions welome

@3flex
Copy link
Contributor

3flex commented Apr 11, 2016

This is Puppet interpolating the string. See https://docs.puppet.com/puppet/latest/reference/lang_variables.html#interpolation

If you don't want it to interpolate and pass $upstream as is then surround it with single quotes, i.e. proxy => '$upstream', or escape the dollar sign so the string isn't treated as a variable: proxy => "\$upstream"

@3flex 3flex closed this as completed Apr 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants