@mstuercke/pulumi-modules 0.0.24 → 1.0.0

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,4 +1,4 @@
1
- import { ComponentResource, type ComponentResourceOptions, type Input, type Output } from '@pulumi/pulumi';
1
+ import { ComponentResource, type ComponentResourceOptions, 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,7 +10,10 @@ export type NodeLambdaFunctionArgs<EnvironmentVariables> = {
10
10
  lambdaPath: string;
11
11
  additionalIamRolePolicies?: SimpleIamRolePolicyConfig[];
12
12
  environmentVariables?: WithInputs<EnvironmentVariables>;
13
- layers?: Input<Input<string>[]>;
13
+ layers?: {
14
+ name: string;
15
+ layerPath: string;
16
+ }[];
14
17
  projectId: string;
15
18
  };
16
19
  export declare class NodeLambdaFunction<EnvironmentVariables extends Record<string, string> = Record<string, string>> extends ComponentResource {
@@ -52,7 +52,20 @@ export class NodeLambdaFunction extends ComponentResource {
52
52
  runtime: runtime,
53
53
  memorySize: memorySize,
54
54
  timeout: timeoutSeconds,
55
- layers: layers,
55
+ layers: layers?.map(({ name, layerPath }) => {
56
+ const layerZip = getFile({
57
+ type: 'zip',
58
+ sourceDir: layerPath,
59
+ outputPath: `dist/lambda-layer/${name}.zip`,
60
+ });
61
+ const layer = new lambda.LayerVersion(name, {
62
+ layerName: name,
63
+ code: new asset.FileArchive(layerZip.then((layerZip) => layerZip.outputPath)),
64
+ sourceCodeHash: layerZip.then((layerZip) => layerZip.outputBase64sha256),
65
+ compatibleRuntimes: [runtime],
66
+ }, opts);
67
+ return layer.arn;
68
+ }),
56
69
  code: new asset.FileArchive(lambdaZip.then((lambdaZip) => lambdaZip.outputPath)),
57
70
  sourceCodeHash: lambdaZip.then((lambdaZip) => lambdaZip.outputBase64sha256),
58
71
  role: role.arn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstuercke/pulumi-modules",
3
- "version": "0.0.24",
3
+ "version": "1.0.0",
4
4
  "files": [
5
5
  "dist/**/!(*.test|*.fixture){.d.ts,.js}",
6
6
  "README.md"
@@ -16,10 +16,10 @@
16
16
  "release": "node --no-warnings --loader ts-node/esm scripts/release.ts"
17
17
  },
18
18
  "dependencies": {
19
- "@mstuercke/pulumi-neon": "0.0.2",
19
+ "@mstuercke/pulumi-neon": "1.0.0",
20
20
  "@pulumi/archive": "^0.3.0",
21
21
  "@pulumi/auth0": "^3.8.1",
22
- "@pulumi/aws": "^6.56.1",
22
+ "@pulumi/aws": "^7.0.0",
23
23
  "@pulumi/mongodbatlas": "^3.27.0",
24
24
  "@pulumi/pulumi": "^3.142.0",
25
25
  "@pulumi/random": "^4.16.7",
@@ -1,14 +0,0 @@
1
- import { type CustomResourceOptions, type Output, Resource } from '@pulumi/pulumi';
2
- export type MongoDBArgs = {
3
- organizationId: string;
4
- projectId: string;
5
- environmentName: string;
6
- };
7
- export declare class MongoDB extends Resource {
8
- readonly connectionString: Output<string>;
9
- readonly databaseName: string;
10
- readonly username: string;
11
- readonly password: Output<string>;
12
- constructor(args: MongoDBArgs, opts?: CustomResourceOptions);
13
- }
14
- //# sourceMappingURL=MongoDB.d.ts.map
@@ -1,51 +0,0 @@
1
- import { Resource } from '@pulumi/pulumi';
2
- import { RandomPassword } from '@pulumi/random';
3
- import { DatabaseUser, Project, ProjectIpAccessList, Provider, ServerlessInstance } from '@pulumi/mongodbatlas';
4
- export class MongoDB extends Resource {
5
- connectionString;
6
- databaseName;
7
- username;
8
- password;
9
- constructor(args, opts) {
10
- const { organizationId, projectId, environmentName } = args;
11
- super('mstuercke:mongodb:MongoDB', organizationId, false, undefined, opts);
12
- new Provider('provider', {}, { parent: this });
13
- const mongoProject = new Project('project', {
14
- orgId: organizationId,
15
- name: `${projectId}-${environmentName}`,
16
- tags: {
17
- project: projectId,
18
- },
19
- }, { parent: this });
20
- new ProjectIpAccessList('network-access', {
21
- projectId: mongoProject.id,
22
- cidrBlock: '0.0.0.0/0',
23
- }, { parent: mongoProject });
24
- const mongoInstance = new ServerlessInstance('database', {
25
- projectId: mongoProject.id,
26
- name: `${projectId}-${environmentName}`,
27
- providerSettingsBackingProviderName: 'AWS',
28
- providerSettingsProviderName: 'SERVERLESS',
29
- providerSettingsRegionName: 'EU_WEST_1', // Ireland
30
- }, { parent: mongoProject });
31
- const username = `${projectId}-${environmentName}`;
32
- const password = new RandomPassword('password', {
33
- length: 32,
34
- }, { parent: mongoProject });
35
- const databaseName = projectId;
36
- new DatabaseUser('user', {
37
- projectId: mongoProject.id,
38
- username,
39
- password: password.result,
40
- authDatabaseName: 'admin',
41
- roles: [
42
- { roleName: 'dbAdmin', databaseName },
43
- { roleName: 'readWrite', databaseName },
44
- ],
45
- }, { parent: mongoProject });
46
- this.connectionString = mongoInstance.connectionStringsStandardSrv;
47
- this.databaseName = databaseName;
48
- this.username = username;
49
- this.password = password.result;
50
- }
51
- }