cloudtools / cloudtools/troposphere

cfn2py tbd: security groups

Open
#190 0 comments 0 reactions 0 assignees View on GitHub
cfn2py
Dominant language
Python
Stars
4.9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Causes like this cause cfn2py to fail.

```
"ZippySecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Enable HTTP access via port 80 and SSH access",
"SecurityGroupIngress" : [

{"IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : "0.0.0.0/0"},
{"IpProtocol" : "tcp", "FromPort" : "443", "ToPort" : "443", "CidrIp" : "0.0.0.0/0"},
{"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"}},
...
```

Something like this in do_resources might help.

```
elif pk == 'SecurityGroupIngress':
print " %s=[" % (pk)
print ',\n'.join([(" SecurityGroupRule(%s)" % (output_dict(rule)))
for rule in pv])
print " ],"
```

I didn't test that, nor did I think thru what utilities for this pattern might already be in place.

---

There is also a rough edge in that a AWS::CloudFormation::WaitConditionHandle with no Properties fails too. Cloud formation doesn't mind that abbreviated form. The cloud formation doc shows an empty Property, so it's easy to work around.

---

Thanks for the nice tool!

Contributor guide

Open the contributing guide

Research direction

Start with the cfn2py resource handling around do_resources and inspect utilities already used for similar property patterns. Reproduce the failures with the supplied SecurityGroupIngress and empty WaitConditionHandle examples. Done means both abbreviated CloudFormation forms are converted without cfn2py failing.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.