Created
July 29, 2014 21:02
-
-
Save clarabstract/b44389f68becd46e8975 to your computer and use it in GitHub Desktop.
Puppet: The End of Reason
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Puppet::Type.newtype(:aws_security_group) do | |
| @doc = "Manage AWS Security Groups" | |
| newparam(:name) | |
| ensurable | |
| newproperty(:description) | |
| newproperty(:vpc) | |
| autorequire(:aws_vpc) do | |
| self[:vpc] | |
| end | |
| newproperty(:tags) | |
| newproperty(:authorize_ingress) do | |
| end | |
| newproperty(:authorize_egress) do | |
| end | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # running apply noop | |
| #Notice: | |
| # .. /Aws_security_group[default]/authorize_ingress: | |
| # current_value | |
| {"protocol"=>"any", "ports"=>[], "sources"=>["0.0.0.0/0"]}, | |
| #should be | |
| {"protocol"=>"any", "ports"=>[], "sources"=>["default"]} | |
| # HI, where is my second array element pretty please? | |
| # Ok, what if we do this? | |
| newproperty(:authorize_ingress, :array_matching => :all) do | |
| end | |
| # Notice: | |
| # .../Aws_security_group[default]/authorize_ingress: | |
| # current_value | |
| {"protocol"=>"any", "ports"=>[], "sources"=>["0.0.0.0/0"]}, | |
| #, should be | |
| {"protocol"=>"any", "ports"=>[], "sources"=>["default"]} {"protocol"=>"tcp", "ports"=>"22", "sources"=>["0.0.0.0/0"]} | |
| # WTF is this? Why isn't it an Array? Where are the []s and the separating comma? | |
| # Is it actually a string? (btw, yes, yes it is) | |
| # Why? | |
| # WHY PUPPET, WHY? | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aws_security_group {'default': | |
| ensure => $ensure, | |
| vpc => "$name-vpc", | |
| authorize_ingress => [ | |
| { | |
| protocol => 'any', | |
| ports => [], | |
| sources => ['default'] | |
| }, | |
| { | |
| protocol => 'tcp', | |
| ports => 22, | |
| sources => ['0.0.0.0/0'], | |
| }, | |
| ], | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment