wallix / awless

A Mighty CLI for AWS
http://awless.io/
Apache License 2.0
4.97k stars 263 forks source link

Variables don't work when quoted #222

Open groorj opened 6 years ago

groorj commented 6 years ago

Hi All,

When working with templates I would like to pass a variable that requires quoting.

create policy name={group_policy_name}_Cloud9 effect=Allow resource="*" description="Cloud9" action=[cloud9:*] conditions="aws:RequestedRegion=={aws_region}"

When I run it, the variable aws_region does not get replaced and it's literal value is used as you can see here:

[info]    Dry running template ...
create policy action=[cloud9:*] conditions='aws:RequestedRegion=={aws_region}' description=Cloud9 effect=Allow name=GroupName_Cloud9 resource=*

Same thing happens if I quote the variable on the description param and if I do not quote it, it works (description param).

It would be interesting to replace the variable on quoted fields like description.

fxaguessy commented 6 years ago

Hi, Thanks for your feedback. Using holes (i.e. missing parameters asked as input of the template) is not possible directly in quoted parameters. However, you can use concatenation (with +) of quoted parameters with holes or references. For example for your template, you could write:

create policy name={group_policy_name}_Cloud9 effect=Allow resource="*" description="Cloud9" action=[cloud9:*] conditions="aws:RequestedRegion=="+{aws_region}

Is this the behavior you expected ?