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

Escaping HIL program delimiters #6655

Closed
ozbillwang opened this issue May 13, 2016 · 2 comments
Closed

Escaping HIL program delimiters #6655

ozbillwang opened this issue May 13, 2016 · 2 comments

Comments

@ozbillwang
Copy link

ozbillwang commented May 13, 2016

Terraform Version

Terraform v0.6.15

Affected Resource(s)

  • aws_instance

Terraform Configuration Files

Debug Output

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

* template_file.userdata.0: failed to render : parse error: syntax error

Expected Behavior

What should have happened?
aws instance should be created.

Actual Behavior

What actually happened?

not created.

In terraform template file, it doesn’t support bash's ${string/#substring/replacement}, even you comment it (put # in front of the line).

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Sample one:

ROLE=role::haproxy
ansible-playbook -c localhost ${ROLE##*:}

I want to get haproxy, but failed.

Sample two:

IP=10.0.0.1
INVENTORY=${IP//./_}   

I want to get 10_0_0_1, but failed.

For example, in second command, I have to replace with sed command:

INVENTORY=$(echo $IP|sed 's/\./_/g')

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

@jen20
Copy link
Contributor

jen20 commented Jun 17, 2016

Hi @SydOps! Assuming I'm understanding your problem correctly, the actual issue here is that by opening a ${} block you are invoking HIL (our interpolation language) and this is indeed a syntax error there. To prevent that I believe you can use $${ content }.

I'll go ahead and close this issue for now - if you have further questions on this please feel free to reopen it!

@jen20 jen20 changed the title In terraform template file, it doesn’t support ${string/#substring/replacement}, even you comment it (put # in front of the line). Escaping HIL program delimiters Jun 17, 2016
@jen20 jen20 closed this as completed Jun 17, 2016
@ghost
Copy link

ghost commented Apr 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants