Skip to content

Commit

Permalink
Merge pull request #22 from Guslington/develop
Browse files Browse the repository at this point in the history
replace hardcoded subnet network prefix with the parameter reference
  • Loading branch information
Guslington authored Jul 25, 2019
2 parents 064905d + 37a677d commit fc04015
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ext/cfndsl/az.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def az_create_subnets(subnet_allocation, subnet_name, type = 'private', vpc = 'V
Condition "Az#{az}"
Type 'AWS::EC2::Subnet'
Property('VpcId', Ref(vpc.to_s))
Property('CidrBlock', FnJoin('', ['10.', Ref('StackOctet'), ".#{subnet_allocation * x + az}.0/24"]))
Property('CidrBlock', FnJoin('', [Ref('NetworkPrefix'), Ref('StackOctet'), ".#{subnet_allocation * x + az}.0/24"]))
Property('AvailabilityZone', Ref("Az#{az}"))
Property('Tags', tags)
end
Expand Down
4 changes: 2 additions & 2 deletions ext/cfndsl/sg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ def lookup_ips(ips, block_name)
def lookup_ips_for_sg (ips, ip_block_name={})
cidr = []
if ip_block_name == 'stack'
cidr = [FnJoin( "", [ "10.", Ref('StackOctet'), ".", "0.0/16" ] )]
cidr = [FnJoin( "", [ Ref('NetworkPrefix'), Ref('StackOctet'), ".", "0.0/16" ] )]
elsif ips.has_key? ip_block_name
ips[ip_block_name].each do |ip|
if (ips.include?(ip) || ip_block_name == 'stack')
cidr += lookup_ips_for_sg(ips, ip) unless ip == ip_block_name
else
if ip == 'stack'
cidr << [FnJoin( "", [ "10.", Ref('StackOctet'), ".", "0.0/16" ] )]
cidr << [FnJoin( "", [ Ref('NetworkPrefix'), Ref('StackOctet'), ".", "0.0/16" ] )]
elsif(isCidr(ip))
cidr << ip
else
Expand Down

0 comments on commit fc04015

Please sign in to comment.