cloudtools / cloudtools/troposphere
cfn2py tbd: security groups
- 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
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