@mstuercke/pulumi-modules 0.0.22 → 0.0.24

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.
@@ -1,10 +1,10 @@
1
1
  import type { Input } from '@pulumi/pulumi';
2
- import type { PolicyStatement } from '@pulumi/aws/iam';
2
+ import type { iam } from '@pulumi/aws';
3
3
  export type SimpleIamRolePolicyConfig = CustomPolicyConfig | DynamoDbPolicyConfig | TimestreamPolicyConfig | S3PolicyConfig | CognitoPolicyConfig | WebsocketPolicyConfig | ExecuteLambdaConfig | SnsPolicyConfig | EventBridgeConfig;
4
4
  interface CustomPolicyConfig {
5
5
  type: 'custom';
6
6
  name: string;
7
- statements: PolicyStatement[];
7
+ statements: iam.PolicyStatement[];
8
8
  }
9
9
  interface DynamoDbPolicyConfig {
10
10
  type: 'dynamodb';
@@ -1,4 +1,4 @@
1
- import { ComponentResource, type ComponentResourceOptions, type Output } from '@pulumi/pulumi';
1
+ import { ComponentResource, type ComponentResourceOptions, type Input, type Output } from '@pulumi/pulumi';
2
2
  import { type SimpleIamRolePolicyConfig } from '../iam/index.ts';
3
3
  import type { WithInputs } from './WithInputs.ts';
4
4
  export type NodeLambdaFunctionArgs<EnvironmentVariables> = {
@@ -10,6 +10,7 @@ export type NodeLambdaFunctionArgs<EnvironmentVariables> = {
10
10
  lambdaPath: string;
11
11
  additionalIamRolePolicies?: SimpleIamRolePolicyConfig[];
12
12
  environmentVariables?: WithInputs<EnvironmentVariables>;
13
+ layers?: Input<Input<string>[]>;
13
14
  projectId: string;
14
15
  };
15
16
  export declare class NodeLambdaFunction<EnvironmentVariables extends Record<string, string> = Record<string, string>> extends ComponentResource {
@@ -8,7 +8,7 @@ export class NodeLambdaFunction extends ComponentResource {
8
8
  invokeArn;
9
9
  constructor(args, opts) {
10
10
  super('mstuercke:lambda:NodeLambdaFunction', args.name, undefined, opts);
11
- const { name, additionalIamRolePolicies = [], environmentVariables = undefined, runtime = 'nodejs22.x', functionHandler = 'lambdaFunction.lambdaHandler', memorySize = 128, timeoutSeconds = 30, projectId, } = args;
11
+ const { name, additionalIamRolePolicies = [], environmentVariables = undefined, runtime = 'nodejs22.x', functionHandler = 'lambdaFunction.lambdaHandler', memorySize = 128, timeoutSeconds = 30, layers, projectId, } = args;
12
12
  const role = new iam.Role(name, {
13
13
  name: `${name}-lambda`,
14
14
  assumeRolePolicy: JSON.stringify({
@@ -52,6 +52,7 @@ export class NodeLambdaFunction extends ComponentResource {
52
52
  runtime: runtime,
53
53
  memorySize: memorySize,
54
54
  timeout: timeoutSeconds,
55
+ layers: layers,
55
56
  code: new asset.FileArchive(lambdaZip.then((lambdaZip) => lambdaZip.outputPath)),
56
57
  sourceCodeHash: lambdaZip.then((lambdaZip) => lambdaZip.outputBase64sha256),
57
58
  role: role.arn,
@@ -1,7 +1,5 @@
1
1
  import * as aws from '@pulumi/aws';
2
- import { apigateway, lambda } from '@pulumi/aws';
3
- import { Record } from '@pulumi/aws/route53';
4
- import { BasePathMapping, DomainName } from '@pulumi/aws/apigateway';
2
+ import { apigateway, lambda, route53 } from '@pulumi/aws';
5
3
  export class RestApi extends aws.apigateway.RestApi {
6
4
  url;
7
5
  constructor(resourceName, args, opts) {
@@ -102,11 +100,11 @@ export class RestApi extends aws.apigateway.RestApi {
102
100
  deployment: deployment.id,
103
101
  tags: { project: projectId },
104
102
  }, { parent: deployment });
105
- const domainName = new DomainName(resourceName, {
103
+ const domainName = new apigateway.DomainName(resourceName, {
106
104
  domainName: domain.fullName,
107
105
  certificateArn: domain.usEast1CertificateArn,
108
106
  }, { parent: this });
109
- new Record(resourceName, {
107
+ new route53.Record(resourceName, {
110
108
  zoneId: domain.zoneId,
111
109
  name: domain.fullName,
112
110
  type: 'A',
@@ -119,7 +117,7 @@ export class RestApi extends aws.apigateway.RestApi {
119
117
  ],
120
118
  allowOverwrite: true,
121
119
  }, { parent: domainName });
122
- new BasePathMapping(resourceName, {
120
+ new apigateway.BasePathMapping(resourceName, {
123
121
  restApi: this.id,
124
122
  stageName: stage.stageName,
125
123
  domainName: domainName.domainName,
@@ -1,8 +1,6 @@
1
1
  import { ComponentResource } from '@pulumi/pulumi';
2
2
  import { s3 } from "../s3/index.js";
3
- import { BucketObject } from '@pulumi/aws/s3';
4
- import { Distribution } from '@pulumi/aws/cloudfront';
5
- import { Record } from '@pulumi/aws/route53';
3
+ import * as aws from '@pulumi/aws';
6
4
  import { readFilesRecursive } from "./readFilesRecursive.js";
7
5
  export class StaticWebsite extends ComponentResource {
8
6
  url;
@@ -18,7 +16,7 @@ export class StaticWebsite extends ComponentResource {
18
16
  },
19
17
  }, { parent: this });
20
18
  for (const file of readFilesRecursive(filesPath)) {
21
- new BucketObject(`${name}-${file.relativePath}`, {
19
+ new aws.s3.BucketObject(`${name}-${file.relativePath}`, {
22
20
  key: file.relativePath,
23
21
  bucket: bucket.id,
24
22
  source: file.absolutePath,
@@ -29,7 +27,7 @@ export class StaticWebsite extends ComponentResource {
29
27
  },
30
28
  }, { parent: bucket });
31
29
  }
32
- const cloudfront = new Distribution(name, {
30
+ const cloudfront = new aws.cloudfront.Distribution(name, {
33
31
  enabled: true,
34
32
  comment: `${projectId} (${environmentName})`,
35
33
  defaultRootObject: 'index.html',
@@ -109,7 +107,7 @@ export class StaticWebsite extends ComponentResource {
109
107
  },
110
108
  }, { parent: this });
111
109
  if (customDomain) {
112
- new Record(name, {
110
+ new aws.route53.Record(name, {
113
111
  zoneId: customDomain?.zoneId,
114
112
  name: customDomain?.fullName,
115
113
  type: 'A',
@@ -1,14 +1,12 @@
1
1
  import { ComponentResource } from '@pulumi/pulumi';
2
- import { Api, ApiMapping, Deployment, DomainName, Integration, IntegrationResponse, Route, Stage, } from '@pulumi/aws/apigatewayv2';
3
- import { Policy, Role } from '@pulumi/aws/iam';
4
- import { Record } from '@pulumi/aws/route53';
2
+ import { apigatewayv2, iam, route53 } from '@pulumi/aws';
5
3
  export class WebsocketApi extends ComponentResource {
6
4
  id;
7
5
  url;
8
6
  constructor(resourceName, args, opts) {
9
7
  super('mstuercke:websocket:WebsocketApi', resourceName, undefined, opts);
10
8
  const { name, lambdaFunction, routeThrottling, stageName = 'v1', domain, projectId } = args;
11
- const api = new Api(resourceName, {
9
+ const api = new apigatewayv2.Api(resourceName, {
12
10
  name,
13
11
  protocolType: 'WEBSOCKET',
14
12
  routeSelectionExpression: '\\$default',
@@ -16,7 +14,7 @@ export class WebsocketApi extends ComponentResource {
16
14
  project: projectId,
17
15
  },
18
16
  }, { parent: this });
19
- const executeLambdaPolicy = new Policy(resourceName, {
17
+ const executeLambdaPolicy = new iam.Policy(resourceName, {
20
18
  name: `${name}-execute-lambda`,
21
19
  path: '/',
22
20
  policy: {
@@ -33,7 +31,7 @@ export class WebsocketApi extends ComponentResource {
33
31
  project: projectId,
34
32
  },
35
33
  }, { parent: api });
36
- const wsApiRole = new Role(resourceName, {
34
+ const wsApiRole = new iam.Role(resourceName, {
37
35
  name: `${name}-role`,
38
36
  assumeRolePolicy: JSON.stringify({
39
37
  Version: '2012-10-17',
@@ -50,7 +48,7 @@ export class WebsocketApi extends ComponentResource {
50
48
  },
51
49
  managedPolicyArns: [executeLambdaPolicy.arn],
52
50
  }, { parent: api });
53
- const wsLambdaIntegration = new Integration(resourceName, {
51
+ const wsLambdaIntegration = new apigatewayv2.Integration(resourceName, {
54
52
  apiId: api.id,
55
53
  integrationType: 'AWS_PROXY',
56
54
  integrationUri: lambdaFunction.invokeArn,
@@ -58,7 +56,7 @@ export class WebsocketApi extends ComponentResource {
58
56
  contentHandlingStrategy: 'CONVERT_TO_TEXT',
59
57
  passthroughBehavior: 'WHEN_NO_MATCH',
60
58
  }, { parent: this });
61
- new IntegrationResponse(resourceName, {
59
+ new apigatewayv2.IntegrationResponse(resourceName, {
62
60
  apiId: api.id,
63
61
  integrationId: wsLambdaIntegration.id,
64
62
  integrationResponseKey: '/200/',
@@ -66,7 +64,7 @@ export class WebsocketApi extends ComponentResource {
66
64
  const routes = [];
67
65
  const routeKeys = ['$connect', '$default', '$disconnect'];
68
66
  for (const routeKey of routeKeys) {
69
- const route = new Route(`${resourceName}-${routeKey}-route`, {
67
+ const route = new apigatewayv2.Route(`${resourceName}-${routeKey}-route`, {
70
68
  apiId: api.id,
71
69
  routeKey: routeKey,
72
70
  target: wsLambdaIntegration.id.apply((id) => `integrations/${id}`),
@@ -74,13 +72,13 @@ export class WebsocketApi extends ComponentResource {
74
72
  }, { parent: wsLambdaIntegration });
75
73
  routes.push(route);
76
74
  }
77
- const deployment = new Deployment(resourceName, {
75
+ const deployment = new apigatewayv2.Deployment(resourceName, {
78
76
  apiId: api.id,
79
77
  }, {
80
78
  dependsOn: [wsLambdaIntegration, ...routes],
81
79
  parent: api,
82
80
  });
83
- const stage = new Stage(resourceName, {
81
+ const stage = new apigatewayv2.Stage(resourceName, {
84
82
  apiId: api.id,
85
83
  name: stageName,
86
84
  deploymentId: deployment.id,
@@ -92,7 +90,7 @@ export class WebsocketApi extends ComponentResource {
92
90
  project: projectId,
93
91
  },
94
92
  }, { parent: deployment });
95
- const domainName = new DomainName(resourceName, {
93
+ const domainName = new apigatewayv2.DomainName(resourceName, {
96
94
  domainName: domain.fullName,
97
95
  domainNameConfiguration: {
98
96
  certificateArn: domain.euCentral1CertificateArn,
@@ -100,7 +98,7 @@ export class WebsocketApi extends ComponentResource {
100
98
  securityPolicy: 'TLS_1_2',
101
99
  },
102
100
  }, { parent: api });
103
- new Record(resourceName, {
101
+ new route53.Record(resourceName, {
104
102
  zoneId: domain.zoneId,
105
103
  name: domain.fullName,
106
104
  type: 'A',
@@ -113,12 +111,12 @@ export class WebsocketApi extends ComponentResource {
113
111
  ],
114
112
  allowOverwrite: true,
115
113
  }, { parent: api });
116
- new ApiMapping(`${resourceName}-root`, {
114
+ new apigatewayv2.ApiMapping(`${resourceName}-root`, {
117
115
  apiId: api.id,
118
116
  domainName: domainName.id,
119
117
  stage: stage.name,
120
118
  }, { parent: api });
121
- new ApiMapping(`${resourceName}-stage`, {
119
+ new apigatewayv2.ApiMapping(`${resourceName}-stage`, {
122
120
  apiId: api.id,
123
121
  domainName: domainName.id,
124
122
  stage: stage.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstuercke/pulumi-modules",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "files": [
5
5
  "dist/**/!(*.test|*.fixture){.d.ts,.js}",
6
6
  "README.md"
@@ -25,12 +25,12 @@
25
25
  "@pulumi/random": "^4.16.7",
26
26
  "@pulumiverse/sentry": "^0.0.9",
27
27
  "@types/mime": "^3.0.4",
28
- "glob": "11.0.1",
28
+ "glob": "11.0.2",
29
29
  "mime": "^3.0.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@mstuercke/node-utils": "0.0.3",
33
- "typescript": "5.7.3"
33
+ "typescript": "5.8.3"
34
34
  },
35
35
  "publishConfig": {
36
36
  "registry": "https://registry.npmjs.org/"