@mstuercke/pulumi-modules 1.0.0 → 1.0.1
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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CustomResourceOptions,
|
|
3
|
+
type Output,
|
|
4
|
+
Resource,
|
|
5
|
+
} from "@pulumi/pulumi";
|
|
6
|
+
export type MongoDBArgs = {
|
|
7
|
+
organizationId: string;
|
|
8
|
+
projectId: string;
|
|
9
|
+
environmentName: string;
|
|
10
|
+
};
|
|
11
|
+
export declare class MongoDB extends Resource {
|
|
12
|
+
readonly connectionString: Output<string>;
|
|
13
|
+
readonly databaseName: string;
|
|
14
|
+
readonly username: string;
|
|
15
|
+
readonly password: Output<string>;
|
|
16
|
+
constructor(args: MongoDBArgs, opts?: CustomResourceOptions);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=MongoDB.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DatabaseUser,
|
|
3
|
+
Project,
|
|
4
|
+
ProjectIpAccessList,
|
|
5
|
+
Provider,
|
|
6
|
+
ServerlessInstance,
|
|
7
|
+
} from "@pulumi/mongodbatlas";
|
|
8
|
+
import { Resource } from "@pulumi/pulumi";
|
|
9
|
+
import { RandomPassword } from "@pulumi/random";
|
|
10
|
+
export class MongoDB extends Resource {
|
|
11
|
+
connectionString;
|
|
12
|
+
databaseName;
|
|
13
|
+
username;
|
|
14
|
+
password;
|
|
15
|
+
constructor(args, opts) {
|
|
16
|
+
const { organizationId, projectId, environmentName } = args;
|
|
17
|
+
super("mstuercke:mongodb:MongoDB", organizationId, false, undefined, opts);
|
|
18
|
+
new Provider("provider", {}, { parent: this });
|
|
19
|
+
const mongoProject = new Project(
|
|
20
|
+
"project",
|
|
21
|
+
{
|
|
22
|
+
orgId: organizationId,
|
|
23
|
+
name: `${projectId}-${environmentName}`,
|
|
24
|
+
tags: {
|
|
25
|
+
project: projectId,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{ parent: this },
|
|
29
|
+
);
|
|
30
|
+
new ProjectIpAccessList(
|
|
31
|
+
"network-access",
|
|
32
|
+
{
|
|
33
|
+
projectId: mongoProject.id,
|
|
34
|
+
cidrBlock: "0.0.0.0/0",
|
|
35
|
+
},
|
|
36
|
+
{ parent: mongoProject },
|
|
37
|
+
);
|
|
38
|
+
const mongoInstance = new ServerlessInstance(
|
|
39
|
+
"database",
|
|
40
|
+
{
|
|
41
|
+
projectId: mongoProject.id,
|
|
42
|
+
name: `${projectId}-${environmentName}`,
|
|
43
|
+
providerSettingsBackingProviderName: "AWS",
|
|
44
|
+
providerSettingsProviderName: "SERVERLESS",
|
|
45
|
+
providerSettingsRegionName: "EU_WEST_1", // Ireland
|
|
46
|
+
},
|
|
47
|
+
{ parent: mongoProject },
|
|
48
|
+
);
|
|
49
|
+
const username = `${projectId}-${environmentName}`;
|
|
50
|
+
const password = new RandomPassword(
|
|
51
|
+
"password",
|
|
52
|
+
{
|
|
53
|
+
length: 32,
|
|
54
|
+
},
|
|
55
|
+
{ parent: mongoProject },
|
|
56
|
+
);
|
|
57
|
+
const databaseName = projectId;
|
|
58
|
+
new DatabaseUser(
|
|
59
|
+
"user",
|
|
60
|
+
{
|
|
61
|
+
projectId: mongoProject.id,
|
|
62
|
+
username,
|
|
63
|
+
password: password.result,
|
|
64
|
+
authDatabaseName: "admin",
|
|
65
|
+
roles: [
|
|
66
|
+
{ roleName: "dbAdmin", databaseName },
|
|
67
|
+
{ roleName: "readWrite", databaseName },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{ parent: mongoProject },
|
|
71
|
+
);
|
|
72
|
+
this.connectionString = mongoInstance.connectionStringsStandardSrv;
|
|
73
|
+
this.databaseName = databaseName;
|
|
74
|
+
this.username = username;
|
|
75
|
+
this.password = password.result;
|
|
76
|
+
}
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mstuercke/pulumi-modules",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
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.2",
|
|
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.8.3"
|
|
33
|
+
"typescript": "^5.8.3"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"registry": "https://registry.npmjs.org/"
|