Skip to content

Commit

Permalink
add constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunmenon95 committed Jul 22, 2024
1 parent 4d94332 commit 5fa1afc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions ecs-task.cfhighlander.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Parameters do
ComponentParam 'EnvironmentName', 'dev', isGlobal: true
ComponentParam 'EnvironmentType', 'development', allowedValues: ['development','production'], isGlobal: true
ComponentParam 'EbsAZ', ''

task_definition.each do |task_def, task|
if task.has_key?('tag_param')
Expand Down
5 changes: 3 additions & 2 deletions ecs-task.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@
EC2_Volume(ebs_volume['name']) do
Size 100
VolumeType "gp3"
AvailabilityZone Ref(:EbsAZ)
end

task_constraints << {Type: "memberOf", Expression: "attribute:ecs.availability-zone in #{Ref(:EbsAZ)}"}
mount_points << { ContainerPath: ebs_volume['container_path'], SourceVolume: Ref(ebs_volume['name']), ReadOnly: false}
task_volumes << { Name: Ref(ebs_volume['name']), ConfiguredAtLaunch: true }
task_def.merge!({MountPoints: mount_points })
Expand Down Expand Up @@ -312,8 +315,6 @@
end
end

print("Task Volumes: #{task_volumes}")

task_type = external_parameters.fetch(:task_type, 'EC2')
unless task_definition.empty?

Expand Down

0 comments on commit 5fa1afc

Please sign in to comment.