Skip to content

Commit

Permalink
Feature: update ecs task component version and fix EnvironmentName ref (
Browse files Browse the repository at this point in the history
#4)

* feat: update ecs-task component ver

* fix: {EnvironmentName}

* chore: update spec files
  • Loading branch information
raykrishardi committed Jun 18, 2024
1 parent 2449a32 commit 197bc0a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ecs-runtask.cfhighlander.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
end

#Pass the all the config from the parent component to the inlined component
Component template: '[email protected].4', name: "#{component_name.gsub('-','').gsub('_','')}Task", render: Inline, config: @config
Component template: '[email protected].9', name: "#{component_name.gsub('-','').gsub('_','')}Task", render: Inline, config: @config

end
4 changes: 2 additions & 2 deletions ecs-runtask.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@
end
Events_Rule(:Schedule) do
Name FnSub("${EnvironmentName}-#{component_name}-eventrule")
Description FnSub("{EnvironmentName} #{component_name} eventrule")
Description FnSub("${EnvironmentName} #{component_name} eventrule")
ScheduleExpression schedule unless schedule.nil?
EventPattern FnSub(event_pattern) unless event_pattern.nil?
Targets [{
Arn: Ref(:StateMachine),
Id: FnSub("{EnvironmentName}-#{component_name}-target"),
Id: FnSub("${EnvironmentName}-#{component_name}-target"),
RoleArn: FnGetAtt('EventBridgeInvokeRole', 'Arn')
}]
end
Expand Down
4 changes: 2 additions & 2 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
end

it "to have property RetentionInDays" do
expect(resource["Properties"]["RetentionInDays"]).to eq("7")
expect(resource["Properties"]["RetentionInDays"]).to eq(7)
end

end
Expand All @@ -97,7 +97,7 @@
end

it "to have property ContainerDefinitions" do
expect(resource["Properties"]["ContainerDefinitions"]).to eq([{"Name"=>"dummy", "Image"=>{"Fn::Join"=>["", ["", "apline", ":", {"Ref"=>"ecsruntaskTaskVersion"}]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"dummy"}}}])
expect(resource["Properties"]["ContainerDefinitions"]).to eq([{"Name"=>"dummy", "Image"=>{"Fn::Join"=>["", [{"Fn::Sub"=>"/apline"}, ":", {"Ref"=>"ecsruntaskTaskVersion"}]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"dummy"}}}])
end

it "to have property RequiresCompatibilities" do
Expand Down
8 changes: 4 additions & 4 deletions spec/event_pattern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@
end

it "to have property Description" do
expect(resource["Properties"]["Description"]).to eq({"Fn::Sub"=>"{EnvironmentName} ecs-runtask eventrule"})
expect(resource["Properties"]["Description"]).to eq({"Fn::Sub"=>"${EnvironmentName} ecs-runtask eventrule"})
end

it "to have property EventPattern" do
expect(resource["Properties"]["EventPattern"]).to eq({"Fn::Sub"=>"{\n \"source\": [\"aws.cloudformation\"],\n \"detail-type\": [\"CloudFormation Stack Status Change\"],\n \"resources\": [\"arn:aws:cloudformation:us-west-2:123456789012:stack/dev-stack\"]\n}"})
end

it "to have property Targets" do
expect(resource["Properties"]["Targets"]).to eq([{"Arn"=>{"Ref"=>"StateMachine"}, "Id"=>{"Fn::Sub"=>"{EnvironmentName}-ecs-runtask-target"}, "RoleArn"=>{"Fn::GetAtt"=>["EventBridgeInvokeRole", "Arn"]}}])
expect(resource["Properties"]["Targets"]).to eq([{"Arn"=>{"Ref"=>"StateMachine"}, "Id"=>{"Fn::Sub"=>"${EnvironmentName}-ecs-runtask-target"}, "RoleArn"=>{"Fn::GetAtt"=>["EventBridgeInvokeRole", "Arn"]}}])
end

end
Expand All @@ -130,7 +130,7 @@
end

it "to have property RetentionInDays" do
expect(resource["Properties"]["RetentionInDays"]).to eq("7")
expect(resource["Properties"]["RetentionInDays"]).to eq(7)
end

end
Expand All @@ -143,7 +143,7 @@
end

it "to have property ContainerDefinitions" do
expect(resource["Properties"]["ContainerDefinitions"]).to eq([{"Name"=>"dummy", "Image"=>{"Fn::Join"=>["", ["", "apline", ":", {"Ref"=>"ecsruntaskTaskVersion"}]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"dummy"}}}])
expect(resource["Properties"]["ContainerDefinitions"]).to eq([{"Name"=>"dummy", "Image"=>{"Fn::Join"=>["", [{"Fn::Sub"=>"/apline"}, ":", {"Ref"=>"ecsruntaskTaskVersion"}]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"dummy"}}}])
end

it "to have property RequiresCompatibilities" do
Expand Down
8 changes: 4 additions & 4 deletions spec/schedule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@
end

it "to have property Description" do
expect(resource["Properties"]["Description"]).to eq({"Fn::Sub"=>"{EnvironmentName} ecs-runtask eventrule"})
expect(resource["Properties"]["Description"]).to eq({"Fn::Sub"=>"${EnvironmentName} ecs-runtask eventrule"})
end

it "to have property ScheduleExpression" do
expect(resource["Properties"]["ScheduleExpression"]).to eq("* * * * *")
end

it "to have property Targets" do
expect(resource["Properties"]["Targets"]).to eq([{"Arn"=>{"Ref"=>"StateMachine"}, "Id"=>{"Fn::Sub"=>"{EnvironmentName}-ecs-runtask-target"}, "RoleArn"=>{"Fn::GetAtt"=>["EventBridgeInvokeRole", "Arn"]}}])
expect(resource["Properties"]["Targets"]).to eq([{"Arn"=>{"Ref"=>"StateMachine"}, "Id"=>{"Fn::Sub"=>"${EnvironmentName}-ecs-runtask-target"}, "RoleArn"=>{"Fn::GetAtt"=>["EventBridgeInvokeRole", "Arn"]}}])
end

end
Expand All @@ -130,7 +130,7 @@
end

it "to have property RetentionInDays" do
expect(resource["Properties"]["RetentionInDays"]).to eq("7")
expect(resource["Properties"]["RetentionInDays"]).to eq(7)
end

end
Expand All @@ -143,7 +143,7 @@
end

it "to have property ContainerDefinitions" do
expect(resource["Properties"]["ContainerDefinitions"]).to eq([{"Name"=>"dummy", "Image"=>{"Fn::Join"=>["", ["", "apline", ":", {"Ref"=>"ecsruntaskTaskVersion"}]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"dummy"}}}])
expect(resource["Properties"]["ContainerDefinitions"]).to eq([{"Name"=>"dummy", "Image"=>{"Fn::Join"=>["", [{"Fn::Sub"=>"/apline"}, ":", {"Ref"=>"ecsruntaskTaskVersion"}]]}, "LogConfiguration"=>{"LogDriver"=>"awslogs", "Options"=>{"awslogs-group"=>{"Ref"=>"LogGroup"}, "awslogs-region"=>{"Ref"=>"AWS::Region"}, "awslogs-stream-prefix"=>"dummy"}}}])
end

it "to have property RequiresCompatibilities" do
Expand Down

0 comments on commit 197bc0a

Please sign in to comment.