Sceptre: Any kind of loops possible?

Created on 27 Feb 2018  路  4Comments  路  Source: Sceptre/sceptre

First, thanks for the sceptre. Awesome tool!

Second, sorry, but I may ask one vague question:

Trying to figure out how could I pass (or iterate over) a list of source security groups in AWS::EC2::SecurityGroupIngress definition. I want to have something like this in config

parameters:
  ListOfSecurityGroups:
    - sg-abcabcd1
    - sg-abcabcd2
    - sg-abcabcd3

and something like this in the template

  SomeSecurityGroupIngress:
    Type: "AWS::EC2::SecurityGroupIngress"
      Properties:
      GroupId: !Ref SomeSecurityGroup
      IpProtocol: tcp
      FromPort: 22
      ToPort: 22
      SourceSecurityGroupId: !Ref ListOfSecurityGroups

The problem is that I can not pass anything but the single SG ID as a plain string into the SourceSecurityGroupId field.

And the question is:

Is there any way to "iterate" over a variable array of string security group IDs within the sceptre template?

Well, if it is not possible, I even could try to implement it myself, if it has some interest for sceptre community.

Thanks!

Most helpful comment

All 4 comments

If programmable code then you should use troposphere. And the template path point to the python file instead of yaml

Great idea @jk2l :clap:

I think it would be enough!

Thank you!

I am trying to iterate with troposphere over a list of subnets, but I keep getting " TypeError: 'Parameter' object is not iterable "

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabiodouek picture fabiodouek  路  5Comments

ngfgrant picture ngfgrant  路  6Comments

jmsuzuki picture jmsuzuki  路  4Comments

sathed picture sathed  路  3Comments

ngfgrant picture ngfgrant  路  3Comments