Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@aws-cdk/aws-events-targets): event-rules cannot have targets with the same construct id #2744

Merged
merged 23 commits into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ce33b40
fix(@aws-cdk/aws-events-targets): event-rules cannot have targets wit…
made2591 Jun 4, 2019
58a6cbc
fix uniqueId dimension to 64 chars
made2591 Jun 6, 2019
b824cd4
Merge branch 'master' into fix/aws-events-node-unique-id
made2591 Jun 6, 2019
5fd1465
fix integ.instance.lit.expected.json (got from Travis): local build d…
made2591 Jun 6, 2019
f4783eb
Merge remote-tracking branch 'upstream/master' into fix/aws-events-no…
made2591 Jun 7, 2019
c378546
move uniqueId cut inside aws-events/lib/rule.ts. change in uniqueId i…
made2591 Jun 7, 2019
bdc8c3c
fix integration tests after uniqueId migration.
made2591 Jun 7, 2019
f099eb0
change uniqueId for ecs-task target rule. fix integration tests
made2591 Jun 7, 2019
be8c70a
Merge remote-tracking branch 'upstream/master'
Jun 7, 2019
02cf01b
Merge branch 'master' into fix/aws-events-node-unique-id
Jun 7, 2019
0f4a4c0
fix integration test in aws-codepipeline-actions/test/
made2591 Jun 10, 2019
e4a8447
Merge remote-tracking branch 'upstream/master' into fix/aws-events-no…
made2591 Jun 10, 2019
7dd818b
fix tests in packages/@aws-cdk/aws-ecs-patterns/test/
made2591 Jun 10, 2019
532c02e
fix test in packages/@aws-cdk/aws-codepipeline-actions/test/integ.lam…
made2591 Jun 10, 2019
c27e874
fix codepipeline actions tests. wip
made2591 Jun 11, 2019
fbfe7d3
Merge remote-tracking branch 'upstream/master' into fix/aws-events-no…
Jun 11, 2019
3c104a7
Merge remote-tracking branch 'upstream/master' into fix/aws-events-no…
made2591 Jun 11, 2019
475301a
fix integration tests accordingly
made2591 Jun 11, 2019
19953e7
Fix import
rix0rrr Jun 12, 2019
f3e3aaa
Update some expectations
rix0rrr Jun 13, 2019
0d4c101
Merge remote-tracking branch 'upstream/master' into fix/aws-events-no…
made2591 Jun 16, 2019
d81c991
Update expectations of lambda sns and sqs
made2591 Jun 16, 2019
981a7d7
Update expectations in @aws-cdk/aws-codepipeline-actions/
made2591 Jun 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@
]
]
},
"Id": "Pipeline",
"Id": "PipelineStackPipeline9DB740AF",
"RoleArn": {
"Fn::GetAtt": [
"PipelineEventsRole46BEEA7C",
Expand Down Expand Up @@ -751,7 +751,7 @@
]
]
},
"Id": "Pipeline",
"Id": "PipelineStackPipeline9DB740AF",
"RoleArn": {
"Fn::GetAtt": [
"PipelineEventsRole46BEEA7C",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
]
]
},
"Id": "Pipeline",
"Id": "awscdkcodepipelinelambdaPipeline87A4B3D3",
"RoleArn": {
"Fn::GetAtt": [
"PipelineEventsRole46BEEA7C",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
]
]
},
"Id": "Pipeline",
"Id": "awscdkcodepipelinecodebuildmultipleinputsoutputsPipeline314D3A85",
"RoleArn": {
"Fn::GetAtt": [
"PipelineEventsRole46BEEA7C",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
]
]
},
"Id": "Pipeline",
"Id": "awscdkcodepipelinecodecommitPipelineF780CA18",
"RoleArn": {
"Fn::GetAtt": [
"PipelineEventsRole46BEEA7C",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
]
]
},
"Id": "MyPipeline",
"Id": "awscdkcodepipelineecrsourceMyPipeline63CF3194",
"RoleArn": {
"Fn::GetAtt": [
"MyPipelineEventsRoleFAB99F32",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
"Arn": {
"Ref": "MyTopic86869434"
},
"Id": "MyTopic"
"Id": "awscdkpipelineeventtargetMyTopic8D32776A"
}
]
}
Expand Down Expand Up @@ -426,7 +426,7 @@
"Arn": {
"Ref": "MyTopic86869434"
},
"Id": "MyTopic"
"Id": "awscdkpipelineeventtargetMyTopic8D32776A"
}
]
}
Expand Down Expand Up @@ -473,7 +473,7 @@
"Arn": {
"Ref": "MyTopic86869434"
},
"Id": "MyTopic",
"Id": "awscdkpipelineeventtargetMyTopic8D32776A",
"InputTransformer": {
"InputPathsMap": {
"detail-pipeline": "$.detail.pipeline",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
"Arn": {
"Ref": "ComplianceTopic0229448B"
},
"Id": "ComplianceTopic"
"Id": "awscdkconfigruleintegComplianceTopic55CAF01A"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@
"Ref": "ScheduledEc2TaskScheduledTaskDef56328BA4"
}
},
"Id": "ScheduledTaskDef-on-EcsCluster",
"Id": "awsecsintegecsScheduledEc2TaskScheduledTaskDef18FB4348",
"Input": "{}",
"RoleArn": {
"Fn::GetAtt": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export = {
TaskCount: 1,
TaskDefinitionArn: { Ref: "ScheduledEc2TaskScheduledTaskDef56328BA4" }
},
Id: "ScheduledTaskDef-on-EcsCluster",
Id: "ScheduledEc2TaskScheduledTaskDef1EA607E3",
Input: "{}",
RoleArn: { "Fn::GetAtt": ["ScheduledEc2TaskScheduledTaskDefEventsRole64113C5F", "Arn"] }
}
Expand Down Expand Up @@ -97,7 +97,7 @@ export = {
TaskCount: 2,
TaskDefinitionArn: { Ref: "ScheduledEc2TaskScheduledTaskDef56328BA4" }
},
Id: "ScheduledTaskDef-on-EcsCluster",
Id: "ScheduledEc2TaskScheduledTaskDef1EA607E3",
Input: "{}",
RoleArn: { "Fn::GetAtt": ["ScheduledEc2TaskScheduledTaskDefEventsRole64113C5F", "Arn"] }
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/lib/codebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class CodeBuildProject implements events.IRuleTarget {
*/
public bind(_rule: events.IRule): events.RuleTargetConfig {
return {
id: this.project.node.id,
id: this.project.node.uniqueId,
arn: this.project.projectArn,
role: singletonEventRole(this.project, [new iam.PolicyStatement()
.addAction('codebuild:StartBuild')
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/lib/codepipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class CodePipeline implements events.IRuleTarget {

public bind(_rule: events.IRule): events.RuleTargetConfig {
return {
id: this.pipeline.node.id,
id: this.pipeline.node.uniqueId,
arn: this.pipeline.pipelineArn,
role: singletonEventRole(this.pipeline, [new iam.PolicyStatement()
.addResource(this.pipeline.pipelineArn)
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/lib/ecs-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class EcsTask implements events.IRuleTarget {
.addResource(this.taskDefinition.taskRole.roleArn));
}

const id = this.taskDefinition.node.id + '-on-' + this.cluster.node.id;
const id = this.taskDefinition.node.uniqueId;
const arn = this.cluster.clusterArn;
const role = singletonEventRole(this.taskDefinition, policyStatements);
const containerOverrides = this.props.containerOverrides && this.props.containerOverrides
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/lib/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class LambdaFunction implements events.IRuleTarget {
}

return {
id: this.handler.node.id,
id: this.handler.node.uniqueId,
arn: this.handler.functionArn,
input: this.props.event,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/lib/sns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class SnsTopic implements events.IRuleTarget {
this.topic.grantPublish(new iam.ServicePrincipal('events.amazonaws.com'));

return {
id: this.topic.node.id,
id: this.topic.node.uniqueId,
arn: this.topic.topicArn,
input: this.props.message,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/lib/sqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class SqsQueue implements events.IRuleTarget {
);

const result = {
id: this.queue.node.id,
id: this.queue.node.uniqueId,
arn: this.queue.queueArn,
input: this.props.message,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/lib/state-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class SfnStateMachine implements events.IRuleTarget {
*/
public bind(_rule: events.IRule): events.RuleTargetConfig {
return {
id: this.machine.node.id,
id: this.machine.node.uniqueId,
arn: this.machine.stateMachineArn,
role: singletonEventRole(this.machine, [new iam.PolicyStatement()
.addAction('states:StartExecution')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"Arn"
]
},
"Id": "MyProject",
"Id": "awscdkcodebuildeventsMyProjectEF919B0E",
"RoleArn": {
"Fn::GetAtt": [
"MyProjectEventsRole5B7D93F5",
Expand All @@ -56,7 +56,7 @@
"Arn": {
"Ref": "MyTopic86869434"
},
"Id": "MyTopic",
"Id": "awscdkcodebuildeventsMyTopic550011DC",
"InputTransformer": {
"InputPathsMap": {
"detail-repositoryName": "$.detail.repositoryName",
Expand All @@ -68,59 +68,6 @@
]
}
},
"MyProjectEventsRole5B7D93F5": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": {
"Fn::Join": [
"",
[
"events.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
"Version": "2012-10-17"
}
}
},
"MyProjectEventsRoleDefaultPolicy397DCBF8": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "codebuild:StartBuild",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"MyProject39F7B0AE",
"Arn"
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "MyProjectEventsRoleDefaultPolicy397DCBF8",
"Roles": [
{
"Ref": "MyProjectEventsRole5B7D93F5"
}
]
}
},
"MyProjectRole9BBE5233": {
"Type": "AWS::IAM::Role",
"Properties": {
Expand Down Expand Up @@ -267,24 +214,24 @@
"source": [
"aws.codebuild"
],
"detail-type": [
"CodeBuild Build State Change"
],
"detail": {
"project-name": [
{
"Ref": "MyProject39F7B0AE"
}
]
}
},
"detail-type": [
"CodeBuild Build State Change"
]
},
"State": "ENABLED",
"Targets": [
{
"Arn": {
"Ref": "MyTopic86869434"
},
"Id": "MyTopic"
"Id": "awscdkcodebuildeventsMyTopic550011DC"
}
]
}
Expand All @@ -296,24 +243,24 @@
"source": [
"aws.codebuild"
],
"detail-type": [
"CodeBuild Build Phase Change"
],
"detail": {
"project-name": [
{
"Ref": "MyProject39F7B0AE"
}
]
}
},
"detail-type": [
"CodeBuild Build Phase Change"
]
},
"State": "ENABLED",
"Targets": [
{
"Arn": {
"Ref": "MyTopic86869434"
},
"Id": "MyTopic",
"Id": "awscdkcodebuildeventsMyTopic550011DC",
"InputTransformer": {
"InputPathsMap": {
"detail-completed-phase": "$.detail.completed-phase"
Expand All @@ -324,6 +271,59 @@
]
}
},
"MyProjectEventsRole5B7D93F5": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": {
"Fn::Join": [
"",
[
"events.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
"Version": "2012-10-17"
}
}
},
"MyProjectEventsRoleDefaultPolicy397DCBF8": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "codebuild:StartBuild",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"MyProject39F7B0AE",
"Arn"
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "MyProjectEventsRoleDefaultPolicy397DCBF8",
"Roles": [
{
"Ref": "MyProjectEventsRole5B7D93F5"
}
]
}
},
"MyQueueE6CA6235": {
"Type": "AWS::SQS::Queue"
},
Expand Down Expand Up @@ -417,4 +417,4 @@
}
}
}
}
}
Loading