diff --git a/ecs-task.cfndsl.rb b/ecs-task.cfndsl.rb index caad7fd..94cf39e 100644 --- a/ecs-task.cfndsl.rb +++ b/ecs-task.cfndsl.rb @@ -30,7 +30,7 @@ name = task.has_key?('name') ? task['name'] : task_name - image_repo = task.has_key?('repo') ? "#{task['repo']}" : '' + image_repo = task.has_key?('repo') ? "#{task['repo']}/" : '' image_name = task.has_key?('image') ? task['image'] : task_name image_tag = task.has_key?('tag') ? "#{task['tag']}" : 'latest' image_tag = task.has_key?('tag_param') ? Ref("#{task['tag_param']}") : image_tag @@ -38,7 +38,7 @@ # create main definition task_def = { Name: name, - Image: FnJoin('', [FnSub("#{image_repo}/#{image_name}"), ":", image_tag]), + Image: FnJoin('', [FnSub("#{image_repo}#{image_name}"), ":", image_tag]), LogConfiguration: { LogDriver: 'awslogs', Options: { diff --git a/spec/depends_on_spec.rb b/spec/depends_on_spec.rb index 5ac28db..22df506 100644 --- a/spec/depends_on_spec.rb +++ b/spec/depends_on_spec.rb @@ -38,7 +38,7 @@ end it "to have property ContainerDefinitions" do - expect(resource["Properties"]["ContainerDefinitions"]).to eq([{"Name"=>"nginx", "Image"=>{"Fn::Join"=>["", [{"Fn::Sub"=>"nginx/nginx"}, ":", "latest"]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"nginx"}}, "DependsOn"=>[{"ContainerName"=>"db", "Condition"=>"START"}]}, {"Name"=>"db", "Image"=>{"Fn::Join"=>["", [{"Fn::Sub"=>"/postgres"}, ":", "latest"]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"db"}}, "Essential"=>false, "PortMappings"=>[{"ContainerPort"=>5432}]}]) + expect(resource["Properties"]["ContainerDefinitions"]).to eq([{"Name"=>"nginx", "Image"=>{"Fn::Join"=>["", [{"Fn::Sub"=>"nginx/nginx"}, ":", "latest"]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"nginx"}}, "DependsOn"=>[{"ContainerName"=>"db", "Condition"=>"START"}]}, {"Name"=>"db", "Image"=>{"Fn::Join"=>["", [{"Fn::Sub"=>"postgres"}, ":", "latest"]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"db"}}, "Essential"=>false, "PortMappings"=>[{"ContainerPort"=>5432}]}]) end it "to have property RequiresCompatibilities" do