Skip to content

Commit

Permalink
move to cfndsl external_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Guslington committed Dec 30, 2019
1 parent d254b4c commit 1c972f6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions jenkins-ec2-agents.cfndsl.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
CloudFormation do

agent_tags = []
agent_tags << { Key: 'Name', Value: FnSub("${EnvironmentName}-#{component_name}") }
agent_tags << { Key: 'Name', Value: FnSub("${EnvironmentName}-#{external_parameters[:component_name]}") }
agent_tags << { Key: 'EnvironmentName', Value: Ref(:EnvironmentName) }
agent_tags << { Key: 'EnvironmentType', Value: Ref(:EnvironmentType) }

iam_policies = external_parameters.fetch(:iam_policies, {})

IAM_Role(:Role) {
Path '/'
AssumeRolePolicyDocument service_assume_role_policy('ec2')
Expand All @@ -19,7 +21,7 @@

EC2_SecurityGroup(:SecurityGroup) {
VpcId Ref(:VPCId)
GroupDescription FnSub("${EnvironmentName}-#{component_name}")
GroupDescription FnSub("${EnvironmentName}-#{external_parameters[:component_name]}")
SecurityGroupIngress([
{
Description: 'ssh access from jenkins master',
Expand All @@ -45,7 +47,7 @@
Type 'String'
Value 'ami-replaceme'
Property('Tags',{
Name: "#{component_name}-linux-ami",
Name: "#{external_parameters[:component_name]}-linux-ami",
EnvironmentName: Ref(:EnvironmentName)
})
}
Expand All @@ -57,7 +59,7 @@
Type 'String'
Value 'ami-replaceme'
Property('Tags',{
Name: "#{component_name}-windows-ami",
Name: "#{external_parameters[:component_name]}-windows-ami",
EnvironmentName: Ref(:EnvironmentName)
})
}
Expand All @@ -69,7 +71,7 @@
Type 'String'
Value FnJoin(' ', Ref(:Subnets))
Property('Tags',{
Name: "#{component_name}-subnets",
Name: "#{external_parameters[:component_name]}-subnets",
EnvironmentName: Ref(:EnvironmentName)
})
}
Expand All @@ -81,7 +83,7 @@
Type 'String'
Value Ref(:SecurityGroup)
Property('Tags',{
Name: "#{component_name}-security-group",
Name: "#{external_parameters[:component_name]}-security-group",
EnvironmentName: Ref(:EnvironmentName)
})
}
Expand All @@ -93,7 +95,7 @@
Type 'String'
Value FnGetAtt(:InstanceProfile,:Arn)
Property('Tags',{
Name: "#{component_name}-instance-profile",
Name: "#{external_parameters[:component_name]}-instance-profile",
EnvironmentName: Ref(:EnvironmentName)
})
}
Expand Down

0 comments on commit 1c972f6

Please sign in to comment.