@webiny/pulumi-aws 0.0.0-mt-2 → 0.0.0-mt-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import * as pulumi from "@pulumi/pulumi";
2
2
  import * as aws from "@pulumi/aws";
3
3
  interface Config {
4
4
  apiFolder?: string;
5
+ apiEnv?: string;
5
6
  }
6
7
  export declare class WebsiteTenantRouter extends pulumi.ComponentResource {
7
8
  readonly originRequest: aws.lambda.Function;
@@ -41,22 +41,22 @@ class WebsiteTenantRouter extends pulumi.ComponentResource {
41
41
  dynamoDbTable
42
42
  } = (0, _utils.getStackOutput)({
43
43
  folder: config.apiFolder || "api",
44
- env: String(process.env.WEBINY_ENV)
44
+ env: config.apiEnv || String(process.env.WEBINY_ENV)
45
45
  });
46
- const callerIdentity = pulumi.output(aws.getCallerIdentity({}));
47
- const tenantRouterPolicy = new aws.iam.Policy(`${name}-policy`, {
48
- name: `${name}-policy`,
49
- policy: {
46
+ const inlinePolicies = Promise.all([aws.getCallerIdentity({})]).then(([callerIdentity]) => [{
47
+ name: "dynamodb-policy",
48
+ policy: JSON.stringify({
50
49
  Version: "2012-10-17",
51
50
  Statement: [{
52
51
  Sid: "PermissionForDynamodb",
53
52
  Effect: "Allow",
54
53
  Action: ["dynamodb:GetItem"],
55
- Resource: [pulumi.interpolate`arn:aws:dynamodb:${region}:${callerIdentity.accountId}:table/${dynamoDbTable}`, pulumi.interpolate`arn:aws:dynamodb:${region}:${callerIdentity.accountId}:table/${dynamoDbTable}/*`]
54
+ Resource: [`arn:aws:dynamodb:${region}:${callerIdentity.accountId}:table/${dynamoDbTable}`, `arn:aws:dynamodb:${region}:${callerIdentity.accountId}:table/${dynamoDbTable}/*`]
56
55
  }]
57
- }
58
- });
56
+ })
57
+ }]);
59
58
  const role = new aws.iam.Role(`${name}-role`, {
59
+ inlinePolicies,
60
60
  managedPolicyArns: [aws.iam.ManagedPolicies.AWSLambdaBasicExecutionRole],
61
61
  assumeRolePolicy: {
62
62
  Version: "2012-10-17",
@@ -72,10 +72,6 @@ class WebsiteTenantRouter extends pulumi.ComponentResource {
72
72
  }
73
73
  }, {
74
74
  parent: this
75
- });
76
- new aws.iam.RolePolicyAttachment(`${name}-dynamodb`, {
77
- role,
78
- policyArn: tenantRouterPolicy.arn
79
75
  }); // Some resources _must_ be put in us-east-1, such as Lambda at Edge.
80
76
 
81
77
  const awsUsEast1 = new aws.Provider("us-east-1", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/pulumi-aws",
3
- "version": "0.0.0-mt-2",
3
+ "version": "0.0.0-mt-3",
4
4
  "main": "index.ts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@pulumi/aws": "^4.10.0",
18
18
  "@pulumi/pulumi": "< 3.18.0",
19
- "@webiny/cli-plugin-deploy-pulumi": "0.0.0-mt-2"
19
+ "@webiny/cli-plugin-deploy-pulumi": "0.0.0-mt-3"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@babel/cli": "^7.12.10",
@@ -24,8 +24,8 @@
24
24
  "@babel/preset-env": "^7.5.5",
25
25
  "@babel/preset-typescript": "^7.8.3",
26
26
  "@babel/runtime": "^7.5.5",
27
- "@webiny/cli": "^0.0.0-mt-2",
28
- "@webiny/project-utils": "^0.0.0-mt-2",
27
+ "@webiny/cli": "^0.0.0-mt-3",
28
+ "@webiny/project-utils": "^0.0.0-mt-3",
29
29
  "rimraf": "^3.0.2",
30
30
  "ttypescript": "^1.5.12",
31
31
  "typescript": "^4.1.3"
@@ -42,5 +42,5 @@
42
42
  ]
43
43
  }
44
44
  },
45
- "gitHead": "3c0dcfb3c22c9f83107fdb97b25014cd03d9db7d"
45
+ "gitHead": "ebea815be2be99404591cba465cc1fe88355bd48"
46
46
  }