Skip to content

Commit

Permalink
fix(sdk): permissions regressions for aws topic and id change for rea…
Browse files Browse the repository at this point in the history
…ct app (#5055)

Followup to #5054 (Accidentally changed sim instead of tf-aws)

Also follow up to #4993 (see topic.ts, reverted a change to call of `addPermissionToInvoke`)

Ran failing AWS tests locally this time to verify fix

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
MarkMcCulloh authored Nov 25, 2023
1 parent 1f575dd commit 8d65129
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 245 deletions.
12 changes: 8 additions & 4 deletions libs/wingsdk/src/target-tf-aws/react-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ export class ReactApp extends ex.ReactApp implements aws.IAwsReactApp {
unlinkSync(join(this._buildPath, ex.WING_JS));
}

const host: cloud.Website = new cloud.Website(this, "host", {
...this._hostProps,
path: this._buildPath,
});
const host: cloud.Website = new cloud.Website(
this,
`${this.node.id}-host`,
{
...this._hostProps,
path: this._buildPath,
}
);

this.node.addDependency(host);
Connections.of(this).add({
Expand Down
2 changes: 1 addition & 1 deletion libs/wingsdk/src/target-tf-aws/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class Topic extends cloud.Topic implements IAwsTopic {
}
);

fn.addPermissionToInvoke(this, "sns.amazonaws.com", this.topic.arn);
fn.addPermissionToInvoke(this, "sns.amazonaws.com", this.topic.arn, {});

Node.of(this).addConnection({
source: this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ exports[`bucket with onCreate method 1`] = `
"action": "lambda:InvokeFunction",
"function_name": "\${aws_lambda_function.my_bucket_oncreate-OnMessage0_773D84E9.function_name}",
"principal": "sns.amazonaws.com",
"qualifier": "\${aws_lambda_function.my_bucket_oncreate-OnMessage0_773D84E9.version}",
"source_arn": "\${aws_sns_topic.my_bucket_oncreate_EF5D7ECA.arn}",
},
},
Expand Down Expand Up @@ -825,7 +824,6 @@ exports[`bucket with onDelete method 1`] = `
"action": "lambda:InvokeFunction",
"function_name": "\${aws_lambda_function.my_bucket_ondelete-OnMessage0_9871443D.function_name}",
"principal": "sns.amazonaws.com",
"qualifier": "\${aws_lambda_function.my_bucket_ondelete-OnMessage0_9871443D.version}",
"source_arn": "\${aws_sns_topic.my_bucket_ondelete_C2E093CB.arn}",
},
},
Expand Down Expand Up @@ -1287,21 +1285,18 @@ exports[`bucket with onEvent method 1`] = `
"action": "lambda:InvokeFunction",
"function_name": "\${aws_lambda_function.my_bucket_oncreate-OnMessage0_773D84E9.function_name}",
"principal": "sns.amazonaws.com",
"qualifier": "\${aws_lambda_function.my_bucket_oncreate-OnMessage0_773D84E9.version}",
"source_arn": "\${aws_sns_topic.my_bucket_oncreate_EF5D7ECA.arn}",
},
"my_bucket_ondelete-OnMessage0_InvokePermission-c8142b51acc0b500d0402de71ecbd0ecf4977ec315_E690DB87": {
"action": "lambda:InvokeFunction",
"function_name": "\${aws_lambda_function.my_bucket_ondelete-OnMessage0_9871443D.function_name}",
"principal": "sns.amazonaws.com",
"qualifier": "\${aws_lambda_function.my_bucket_ondelete-OnMessage0_9871443D.version}",
"source_arn": "\${aws_sns_topic.my_bucket_ondelete_C2E093CB.arn}",
},
"my_bucket_onupdate-OnMessage0_InvokePermission-c810a1e91f70a36a50557a2c23bc28c96365a22f22_7EE27EAF": {
"action": "lambda:InvokeFunction",
"function_name": "\${aws_lambda_function.my_bucket_onupdate-OnMessage0_EB805895.function_name}",
"principal": "sns.amazonaws.com",
"qualifier": "\${aws_lambda_function.my_bucket_onupdate-OnMessage0_EB805895.version}",
"source_arn": "\${aws_sns_topic.my_bucket_onupdate_DF9292B4.arn}",
},
},
Expand Down Expand Up @@ -1967,7 +1962,6 @@ exports[`bucket with onUpdate method 1`] = `
"action": "lambda:InvokeFunction",
"function_name": "\${aws_lambda_function.my_bucket_onupdate-OnMessage0_EB805895.function_name}",
"principal": "sns.amazonaws.com",
"qualifier": "\${aws_lambda_function.my_bucket_onupdate-OnMessage0_EB805895.version}",
"source_arn": "\${aws_sns_topic.my_bucket_onupdate_DF9292B4.arn}",
},
},
Expand Down
Loading

0 comments on commit 8d65129

Please sign in to comment.