wallix / awless

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

Multiple values for subnets=, securitygroups=. How to use them? #136

Closed avoidik closed 7 years ago

avoidik commented 7 years ago

I'd like to create load-balancer with multiple subnets attached, but can't. Scanning the tests I've found some templates, but they didn't work for me. Also I have no clear understanding how wordpress-ha template is deploying, because of lack of variables like {wordpress.subnets}. Could you kindly help me with this?

subnet_1 = create subnet cidr={subnet1.cidr} vpc=$vpc availabilityzone={subnet1.az} name={subnet1.name}
subnet_2 = create subnet cidr={subnet2.cidr} vpc=$vpc availabilityzone={subnet2.az} name={subnet2.name}
...
lbservice = create loadbalancer name={lb.name} subnets=[$subnet_1, $subnet_2] securitygroups=$lbsecgroup
avoidik commented 7 years ago

The error log:

[error]   error parsing template at line 28 (char 55):
...
-> lbservice = create loadbalancer name={lb.name} subnets=
...
avoidik commented 7 years ago

awless downloaded from the binary

$ awless version
awless version=v0.1.2, commit=eba3785ddc894b116cf0762e1759c26c459f8077, build-date=2017-08-17T11:20:20+02:00, build-arch=amd64, build-os=linux, build-for=targz
fxaguessy commented 7 years ago

Hi, thanks the feedback. As you can see in the CHANGELOG, we just implemented a better support for lists in the templating language. This will be in next release (v0.1.3) but is already available on master.

Starting with v0.1.3, you can create lists in template with, for example, subnets = [$subnet1, $subnet2]. Note that before releasing this new version, we will also update templates of awless-templates with this new way to provide lists, which is much more convenient as the previous one.

avoidik commented 7 years ago

I have compiled binary from master and able to run my template, thank you. BTW is it possible to import file's content into a variable? Use case is Route53 TXT-record for DKIM, which should contain RSA public-key

fxaguessy commented 7 years ago

Thanks for the suggestion, that's a good use case. I created a new issue for this suggestion (#137). As this question seems answered, I close this issue.