@reyemtech/nimbus 1.1.2 → 1.3.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.
- package/dist/cjs/azure/index.d.ts +1 -0
- package/dist/cjs/azure/index.d.ts.map +1 -1
- package/dist/cjs/azure/index.js +3 -1
- package/dist/cjs/azure/index.js.map +1 -1
- package/dist/cjs/azure/resource-group.d.ts +37 -0
- package/dist/cjs/azure/resource-group.d.ts.map +1 -0
- package/dist/cjs/azure/resource-group.js +79 -0
- package/dist/cjs/azure/resource-group.js.map +1 -0
- package/dist/cjs/azure/secrets.d.ts +6 -3
- package/dist/cjs/azure/secrets.d.ts.map +1 -1
- package/dist/cjs/azure/secrets.js +17 -3
- package/dist/cjs/azure/secrets.js.map +1 -1
- package/dist/cjs/cli/azure-prompts.d.ts +31 -0
- package/dist/cjs/cli/azure-prompts.d.ts.map +1 -0
- package/dist/cjs/cli/azure-prompts.js +49 -0
- package/dist/cjs/cli/azure-prompts.js.map +1 -0
- package/dist/cjs/cli/prompt.d.ts +34 -0
- package/dist/cjs/cli/prompt.d.ts.map +1 -0
- package/dist/cjs/cli/prompt.js +61 -0
- package/dist/cjs/cli/prompt.js.map +1 -0
- package/dist/cjs/cli/templates-azure.d.ts +34 -0
- package/dist/cjs/cli/templates-azure.d.ts.map +1 -0
- package/dist/cjs/cli/templates-azure.js +449 -0
- package/dist/cjs/cli/templates-azure.js.map +1 -0
- package/dist/cjs/cli/templates.d.ts +12 -22
- package/dist/cjs/cli/templates.d.ts.map +1 -1
- package/dist/cjs/cli/templates.js +11 -424
- package/dist/cjs/cli/templates.js.map +1 -1
- package/dist/cjs/cli.js +26 -4
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/factories/secrets.d.ts +1 -1
- package/dist/cjs/factories/secrets.js +3 -3
- package/dist/cjs/factories/secrets.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/azure/index.d.ts +1 -0
- package/dist/esm/azure/index.d.ts.map +1 -1
- package/dist/esm/azure/index.js +3 -1
- package/dist/esm/azure/index.js.map +1 -1
- package/dist/esm/azure/resource-group.d.ts +37 -0
- package/dist/esm/azure/resource-group.d.ts.map +1 -0
- package/dist/esm/azure/resource-group.js +79 -0
- package/dist/esm/azure/resource-group.js.map +1 -0
- package/dist/esm/azure/secrets.d.ts +6 -3
- package/dist/esm/azure/secrets.d.ts.map +1 -1
- package/dist/esm/azure/secrets.js +17 -3
- package/dist/esm/azure/secrets.js.map +1 -1
- package/dist/esm/cli/azure-prompts.d.ts +31 -0
- package/dist/esm/cli/azure-prompts.d.ts.map +1 -0
- package/dist/esm/cli/azure-prompts.js +49 -0
- package/dist/esm/cli/azure-prompts.js.map +1 -0
- package/dist/esm/cli/prompt.d.ts +34 -0
- package/dist/esm/cli/prompt.d.ts.map +1 -0
- package/dist/esm/cli/prompt.js +61 -0
- package/dist/esm/cli/prompt.js.map +1 -0
- package/dist/esm/cli/templates-azure.d.ts +34 -0
- package/dist/esm/cli/templates-azure.d.ts.map +1 -0
- package/dist/esm/cli/templates-azure.js +449 -0
- package/dist/esm/cli/templates-azure.js.map +1 -0
- package/dist/esm/cli/templates.d.ts +12 -22
- package/dist/esm/cli/templates.d.ts.map +1 -1
- package/dist/esm/cli/templates.js +11 -424
- package/dist/esm/cli/templates.js.map +1 -1
- package/dist/esm/cli.js +26 -4
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/factories/secrets.d.ts +1 -1
- package/dist/esm/factories/secrets.js +3 -3
- package/dist/esm/factories/secrets.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,4 +8,5 @@ export { createAksCluster, type IAksOptions } from "./cluster";
|
|
|
8
8
|
export { createAzureDns, type IAzureDnsOptions } from "./dns";
|
|
9
9
|
export { createAzureSecrets, type IAzureSecretsOptions } from "./secrets";
|
|
10
10
|
export { createAzureStateBackend, type IAzureStateBackendOptions } from "./state";
|
|
11
|
+
export { ensureResourceGroup, type IResourceGroupOptions } from "./resource-group";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/azure/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,KAAK,yBAAyB,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/azure/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,KAAK,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/cjs/azure/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @module azure
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.createAzureStateBackend = exports.createAzureSecrets = exports.createAzureDns = exports.createAksCluster = exports.createAzureNetwork = void 0;
|
|
8
|
+
exports.ensureResourceGroup = exports.createAzureStateBackend = exports.createAzureSecrets = exports.createAzureDns = exports.createAksCluster = exports.createAzureNetwork = void 0;
|
|
9
9
|
var network_1 = require("./network");
|
|
10
10
|
Object.defineProperty(exports, "createAzureNetwork", { enumerable: true, get: function () { return network_1.createAzureNetwork; } });
|
|
11
11
|
var cluster_1 = require("./cluster");
|
|
@@ -16,4 +16,6 @@ var secrets_1 = require("./secrets");
|
|
|
16
16
|
Object.defineProperty(exports, "createAzureSecrets", { enumerable: true, get: function () { return secrets_1.createAzureSecrets; } });
|
|
17
17
|
var state_1 = require("./state");
|
|
18
18
|
Object.defineProperty(exports, "createAzureStateBackend", { enumerable: true, get: function () { return state_1.createAzureStateBackend; } });
|
|
19
|
+
var resource_group_1 = require("./resource-group");
|
|
20
|
+
Object.defineProperty(exports, "ensureResourceGroup", { enumerable: true, get: function () { return resource_group_1.ensureResourceGroup; } });
|
|
19
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/azure/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,qCAA0E;AAAjE,6GAAA,kBAAkB,OAAA;AAC3B,qCAA+D;AAAtD,2GAAA,gBAAgB,OAAA;AACzB,6BAA8D;AAArD,qGAAA,cAAc,OAAA;AACvB,qCAA0E;AAAjE,6GAAA,kBAAkB,OAAA;AAC3B,iCAAkF;AAAzE,gHAAA,uBAAuB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/azure/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,qCAA0E;AAAjE,6GAAA,kBAAkB,OAAA;AAC3B,qCAA+D;AAAtD,2GAAA,gBAAgB,OAAA;AACzB,6BAA8D;AAArD,qGAAA,cAAc,OAAA;AACvB,qCAA0E;AAAjE,6GAAA,kBAAkB,OAAA;AAC3B,iCAAkF;AAAzE,gHAAA,uBAAuB,OAAA;AAChC,mDAAmF;AAA1E,qHAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource group abstraction — declare once, reuse across all Azure resources.
|
|
3
|
+
*
|
|
4
|
+
* Caches by name so multiple factories referencing the same resource group
|
|
5
|
+
* share a single Pulumi resource declaration. Idempotent by design:
|
|
6
|
+
* Pulumi handles create/update/no-op on each `pulumi up`.
|
|
7
|
+
*
|
|
8
|
+
* @module azure/resource-group
|
|
9
|
+
*/
|
|
10
|
+
import type * as pulumi from "@pulumi/pulumi";
|
|
11
|
+
/** Options for {@link ensureResourceGroup}. */
|
|
12
|
+
export interface IResourceGroupOptions {
|
|
13
|
+
/** Tags to apply to the resource group. */
|
|
14
|
+
readonly tags?: Record<string, string>;
|
|
15
|
+
/** Azure location override. Defaults to the Pulumi-configured region. */
|
|
16
|
+
readonly location?: pulumi.Input<string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Ensure a resource group is declared in the Pulumi stack.
|
|
20
|
+
*
|
|
21
|
+
* First call creates the Pulumi resource; subsequent calls with the
|
|
22
|
+
* same name return the cached reference. This is pure declaration —
|
|
23
|
+
* Pulumi decides whether to create, update, or skip at deploy time.
|
|
24
|
+
*
|
|
25
|
+
* @param name - Desired resource group name in Azure (e.g. "rg-myapp-canadacentral")
|
|
26
|
+
* @param opts - Optional tags and location override
|
|
27
|
+
* @returns The ResourceGroup's name as a Pulumi Output (for dependency chaining)
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const rgName = ensureResourceGroup("rg-prod-canadacentral", {
|
|
32
|
+
* tags: { environment: "production" },
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function ensureResourceGroup(name: string, opts?: IResourceGroupOptions): pulumi.Output<string>;
|
|
37
|
+
//# sourceMappingURL=resource-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-group.d.ts","sourceRoot":"","sources":["../../../src/azure/resource-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAK9C,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,qBAAqB,GAC3B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAYvB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Resource group abstraction — declare once, reuse across all Azure resources.
|
|
4
|
+
*
|
|
5
|
+
* Caches by name so multiple factories referencing the same resource group
|
|
6
|
+
* share a single Pulumi resource declaration. Idempotent by design:
|
|
7
|
+
* Pulumi handles create/update/no-op on each `pulumi up`.
|
|
8
|
+
*
|
|
9
|
+
* @module azure/resource-group
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ensureResourceGroup = ensureResourceGroup;
|
|
46
|
+
const azure = __importStar(require("@pulumi/azure-native/resources"));
|
|
47
|
+
/** Cache of declared resource groups, keyed by name. */
|
|
48
|
+
const cache = new Map();
|
|
49
|
+
/**
|
|
50
|
+
* Ensure a resource group is declared in the Pulumi stack.
|
|
51
|
+
*
|
|
52
|
+
* First call creates the Pulumi resource; subsequent calls with the
|
|
53
|
+
* same name return the cached reference. This is pure declaration —
|
|
54
|
+
* Pulumi decides whether to create, update, or skip at deploy time.
|
|
55
|
+
*
|
|
56
|
+
* @param name - Desired resource group name in Azure (e.g. "rg-myapp-canadacentral")
|
|
57
|
+
* @param opts - Optional tags and location override
|
|
58
|
+
* @returns The ResourceGroup's name as a Pulumi Output (for dependency chaining)
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const rgName = ensureResourceGroup("rg-prod-canadacentral", {
|
|
63
|
+
* tags: { environment: "production" },
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
function ensureResourceGroup(name, opts) {
|
|
68
|
+
const existing = cache.get(name);
|
|
69
|
+
if (existing)
|
|
70
|
+
return existing.name;
|
|
71
|
+
const rg = new azure.ResourceGroup(`nimbus-rg-${name}`, {
|
|
72
|
+
resourceGroupName: name,
|
|
73
|
+
location: opts?.location,
|
|
74
|
+
tags: opts?.tags,
|
|
75
|
+
});
|
|
76
|
+
cache.set(name, rg);
|
|
77
|
+
return rg.name;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=resource-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-group.js","sourceRoot":"","sources":["../../../src/azure/resource-group.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCH,kDAeC;AA/CD,sEAAwD;AAGxD,wDAAwD;AACxD,MAAM,KAAK,GAAG,IAAI,GAAG,EAA+B,CAAC;AAUrD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,mBAAmB,CACjC,IAAY,EACZ,IAA4B;IAE5B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,IAAI,CAAC;IAEnC,MAAM,EAAE,GAAG,IAAI,KAAK,CAAC,aAAa,CAAC,aAAa,IAAI,EAAE,EAAE;QACtD,iBAAiB,EAAE,IAAI;QACvB,QAAQ,EAAE,IAAI,EAAE,QAAQ;QACxB,IAAI,EAAE,IAAI,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,IAAI,CAAC;AACjB,CAAC"}
|
|
@@ -9,8 +9,8 @@ import type { ISecrets, ISecretsConfig } from "../secrets";
|
|
|
9
9
|
export interface IAzureSecretsOptions {
|
|
10
10
|
/** Resource group name. Required for Azure. */
|
|
11
11
|
readonly resourceGroupName: pulumi.Input<string>;
|
|
12
|
-
/** Azure AD tenant ID.
|
|
13
|
-
readonly tenantId
|
|
12
|
+
/** Azure AD tenant ID. Auto-detected via `getClientConfigOutput()` when omitted. */
|
|
13
|
+
readonly tenantId?: pulumi.Input<string>;
|
|
14
14
|
/** Object ID of the principal that should have access to secrets. */
|
|
15
15
|
readonly objectId?: pulumi.Input<string>;
|
|
16
16
|
/** Key Vault SKU. Default: "standard". */
|
|
@@ -19,6 +19,10 @@ export interface IAzureSecretsOptions {
|
|
|
19
19
|
/**
|
|
20
20
|
* Create an Azure Key Vault for secret management.
|
|
21
21
|
*
|
|
22
|
+
* When `tenantId` is omitted, it is auto-detected from the current Azure
|
|
23
|
+
* identity via `getClientConfigOutput()`. A Key Vault Secrets Officer RBAC
|
|
24
|
+
* role assignment is automatically created for the deploying principal.
|
|
25
|
+
*
|
|
22
26
|
* @example
|
|
23
27
|
* ```typescript
|
|
24
28
|
* const secrets = createAzureSecrets("prod", {
|
|
@@ -26,7 +30,6 @@ export interface IAzureSecretsOptions {
|
|
|
26
30
|
* backend: "azure-key-vault",
|
|
27
31
|
* }, {
|
|
28
32
|
* resourceGroupName: "my-rg",
|
|
29
|
-
* tenantId: "00000000-0000-0000-0000-000000000000",
|
|
30
33
|
* });
|
|
31
34
|
*
|
|
32
35
|
* secrets.putSecret("database", { host: "db.example.com", password: dbPassword });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../src/azure/secrets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,EAAc,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../src/azure/secrets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,EAAc,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAYvE,sCAAsC;AACtC,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjD,oFAAoF;IACpF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzC,0CAA0C;IAC1C,QAAQ,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,oBAAoB,GAC5B,QAAQ,CAmHV"}
|
|
@@ -46,9 +46,15 @@ const types_1 = require("../types");
|
|
|
46
46
|
const KEY_VAULT_NAME_MAX_LENGTH = 24;
|
|
47
47
|
/** Default soft-delete retention period in days for Key Vault. */
|
|
48
48
|
const SOFT_DELETE_RETENTION_DAYS = 90;
|
|
49
|
+
/** Well-known role definition ID for Key Vault Secrets Officer. */
|
|
50
|
+
const KEY_VAULT_SECRETS_OFFICER_ROLE_ID = "b86a8fe4-44ce-4948-aee5-eccb2c155cd7";
|
|
49
51
|
/**
|
|
50
52
|
* Create an Azure Key Vault for secret management.
|
|
51
53
|
*
|
|
54
|
+
* When `tenantId` is omitted, it is auto-detected from the current Azure
|
|
55
|
+
* identity via `getClientConfigOutput()`. A Key Vault Secrets Officer RBAC
|
|
56
|
+
* role assignment is automatically created for the deploying principal.
|
|
57
|
+
*
|
|
52
58
|
* @example
|
|
53
59
|
* ```typescript
|
|
54
60
|
* const secrets = createAzureSecrets("prod", {
|
|
@@ -56,7 +62,6 @@ const SOFT_DELETE_RETENTION_DAYS = 90;
|
|
|
56
62
|
* backend: "azure-key-vault",
|
|
57
63
|
* }, {
|
|
58
64
|
* resourceGroupName: "my-rg",
|
|
59
|
-
* tenantId: "00000000-0000-0000-0000-000000000000",
|
|
60
65
|
* });
|
|
61
66
|
*
|
|
62
67
|
* secrets.putSecret("database", { host: "db.example.com", password: dbPassword });
|
|
@@ -68,12 +73,15 @@ function createAzureSecrets(name, config, options) {
|
|
|
68
73
|
const target = (0, types_1.resolveCloudTarget)(cloud);
|
|
69
74
|
const tags = config.tags ?? {};
|
|
70
75
|
const rgName = options.resourceGroupName;
|
|
76
|
+
// Auto-detect tenantId from current Azure identity when not provided
|
|
77
|
+
const clientConfig = azure.authorization.getClientConfigOutput();
|
|
78
|
+
const tenantId = options.tenantId ?? clientConfig.tenantId;
|
|
71
79
|
// Key Vault names must be 3-24 chars, alphanumeric + hyphens
|
|
72
80
|
const vaultName = name.replace(/[^a-zA-Z0-9-]/g, "-").substring(0, KEY_VAULT_NAME_MAX_LENGTH);
|
|
73
81
|
const accessPolicies = [];
|
|
74
82
|
if (options.objectId) {
|
|
75
83
|
accessPolicies.push({
|
|
76
|
-
tenantId
|
|
84
|
+
tenantId,
|
|
77
85
|
objectId: options.objectId,
|
|
78
86
|
permissions: {
|
|
79
87
|
secrets: ["Get", "List", "Set", "Delete"],
|
|
@@ -84,7 +92,7 @@ function createAzureSecrets(name, config, options) {
|
|
|
84
92
|
vaultName,
|
|
85
93
|
resourceGroupName: rgName,
|
|
86
94
|
properties: {
|
|
87
|
-
tenantId
|
|
95
|
+
tenantId,
|
|
88
96
|
sku: {
|
|
89
97
|
family: "A",
|
|
90
98
|
name: options.sku === "premium"
|
|
@@ -98,6 +106,12 @@ function createAzureSecrets(name, config, options) {
|
|
|
98
106
|
},
|
|
99
107
|
tags: { ...tags, Name: `${name}-kv` },
|
|
100
108
|
});
|
|
109
|
+
// Grant the deploying principal Key Vault Secrets Officer on this vault
|
|
110
|
+
new azure.authorization.RoleAssignment(`${name}-kv-secrets-officer`, {
|
|
111
|
+
principalId: clientConfig.objectId,
|
|
112
|
+
roleDefinitionId: clientConfig.subscriptionId.apply((sub) => `/subscriptions/${sub}/providers/Microsoft.Authorization/roleDefinitions/${KEY_VAULT_SECRETS_OFFICER_ROLE_ID}`),
|
|
113
|
+
scope: vault.id,
|
|
114
|
+
});
|
|
101
115
|
// Track created secrets for getSecretRef lookups
|
|
102
116
|
const secretResources = new Map();
|
|
103
117
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../../src/azure/secrets.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../../src/azure/secrets.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDH,gDAuHC;AArKD,4DAA8C;AAC9C,uDAAyC;AAEzC,oCAA8C;AAE9C,qFAAqF;AACrF,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC,kEAAkE;AAClE,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,mEAAmE;AACnE,MAAM,iCAAiC,GAAG,sCAAsC,CAAC;AAcjF;;;;;;;;;;;;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,CAAC;gBACR,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;oBACvC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAA2B,CAAC;oBACzE,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;gBAC3B,CAAC,CAAC,CAAC;YACL,CAAC;YACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Azure-specific CLI prompt orchestration for `nimbus new`.
|
|
3
|
+
*
|
|
4
|
+
* Prompts users for Azure region and resource group name
|
|
5
|
+
* when scaffolding Azure templates.
|
|
6
|
+
*
|
|
7
|
+
* @module cli/azure-prompts
|
|
8
|
+
*/
|
|
9
|
+
import type { TemplateName } from "./templates.js";
|
|
10
|
+
/** Azure configuration values collected from interactive prompts. */
|
|
11
|
+
export interface IAzureTemplateOptions {
|
|
12
|
+
readonly region: string;
|
|
13
|
+
readonly resourceGroupName: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check whether a template requires Azure prompts.
|
|
17
|
+
*
|
|
18
|
+
* @param template - Template name to check
|
|
19
|
+
* @returns True if the template needs Azure configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare function requiresAzurePrompts(template: TemplateName): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Prompt the user for Azure configuration values.
|
|
24
|
+
*
|
|
25
|
+
* Asks for region and resource group name.
|
|
26
|
+
*
|
|
27
|
+
* @param projectName - Project name used for default resource group
|
|
28
|
+
* @returns Azure template options collected from the user
|
|
29
|
+
*/
|
|
30
|
+
export declare function promptForAzureOptions(projectName: string): Promise<IAzureTemplateOptions>;
|
|
31
|
+
//# sourceMappingURL=azure-prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-prompts.d.ts","sourceRoot":"","sources":["../../../src/cli/azure-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAKD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkB/F"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Azure-specific CLI prompt orchestration for `nimbus new`.
|
|
4
|
+
*
|
|
5
|
+
* Prompts users for Azure region and resource group name
|
|
6
|
+
* when scaffolding Azure templates.
|
|
7
|
+
*
|
|
8
|
+
* @module cli/azure-prompts
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.requiresAzurePrompts = requiresAzurePrompts;
|
|
12
|
+
exports.promptForAzureOptions = promptForAzureOptions;
|
|
13
|
+
const prompt_js_1 = require("./prompt.js");
|
|
14
|
+
/** Templates that require Azure configuration prompts. */
|
|
15
|
+
const AZURE_TEMPLATES = ["minimal-azure", "azure", "multi-cloud"];
|
|
16
|
+
/**
|
|
17
|
+
* Check whether a template requires Azure prompts.
|
|
18
|
+
*
|
|
19
|
+
* @param template - Template name to check
|
|
20
|
+
* @returns True if the template needs Azure configuration
|
|
21
|
+
*/
|
|
22
|
+
function requiresAzurePrompts(template) {
|
|
23
|
+
return AZURE_TEMPLATES.includes(template);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Prompt the user for Azure configuration values.
|
|
27
|
+
*
|
|
28
|
+
* Asks for region and resource group name.
|
|
29
|
+
*
|
|
30
|
+
* @param projectName - Project name used for default resource group
|
|
31
|
+
* @returns Azure template options collected from the user
|
|
32
|
+
*/
|
|
33
|
+
async function promptForAzureOptions(projectName) {
|
|
34
|
+
const rl = (0, prompt_js_1.createPromptInterface)();
|
|
35
|
+
try {
|
|
36
|
+
console.log("\nAzure configuration:\n");
|
|
37
|
+
const region = await (0, prompt_js_1.askQuestion)(rl, "Azure region", {
|
|
38
|
+
defaultValue: "canadacentral",
|
|
39
|
+
});
|
|
40
|
+
const resourceGroupName = await (0, prompt_js_1.askQuestion)(rl, "Resource group name", {
|
|
41
|
+
defaultValue: `rg-${projectName}-${region}`,
|
|
42
|
+
});
|
|
43
|
+
return { region, resourceGroupName };
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
rl.close();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=azure-prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-prompts.js","sourceRoot":"","sources":["../../../src/cli/azure-prompts.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAoBH,oDAEC;AAUD,sDAkBC;AAhDD,2CAAiE;AASjE,0DAA0D;AAC1D,MAAM,eAAe,GAAgC,CAAC,eAAe,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AAE/F;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,QAAsB;IACzD,OAAO,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,qBAAqB,CAAC,WAAmB;IAC7D,MAAM,EAAE,GAAG,IAAA,iCAAqB,GAAE,CAAC;IAEnC,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QAExC,MAAM,MAAM,GAAG,MAAM,IAAA,uBAAW,EAAC,EAAE,EAAE,cAAc,EAAE;YACnD,YAAY,EAAE,eAAe;SAC9B,CAAC,CAAC;QAEH,MAAM,iBAAiB,GAAG,MAAM,IAAA,uBAAW,EAAC,EAAE,EAAE,qBAAqB,EAAE;YACrE,YAAY,EAAE,MAAM,WAAW,IAAI,MAAM,EAAE;SAC5C,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IACvC,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic readline prompt utility for CLI interactive input.
|
|
3
|
+
*
|
|
4
|
+
* Uses Node's built-in `readline` module to prompt users for input.
|
|
5
|
+
*
|
|
6
|
+
* @module cli/prompt
|
|
7
|
+
*/
|
|
8
|
+
import type { Interface as ReadlineInterface } from "readline";
|
|
9
|
+
/** Options for a single prompt question. */
|
|
10
|
+
export interface IPromptOptions {
|
|
11
|
+
/** Default value shown in brackets, used if user presses Enter. */
|
|
12
|
+
readonly defaultValue?: string;
|
|
13
|
+
/** If true, re-prompts when the answer is empty and no default is set. */
|
|
14
|
+
readonly required?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create a readline interface for interactive prompts.
|
|
18
|
+
*
|
|
19
|
+
* @returns A readline interface connected to stdin/stdout
|
|
20
|
+
*/
|
|
21
|
+
export declare function createPromptInterface(): ReadlineInterface;
|
|
22
|
+
/**
|
|
23
|
+
* Ask the user a question via readline and return their answer.
|
|
24
|
+
*
|
|
25
|
+
* Shows the default value in brackets (e.g., `"Region [canadacentral]: "`).
|
|
26
|
+
* Re-prompts if `required` is true and the answer is empty with no default.
|
|
27
|
+
*
|
|
28
|
+
* @param rl - Readline interface
|
|
29
|
+
* @param question - The question text to display
|
|
30
|
+
* @param options - Prompt options (defaultValue, required)
|
|
31
|
+
* @returns The user's answer or the default value
|
|
32
|
+
*/
|
|
33
|
+
export declare function askQuestion(rl: ReadlineInterface, question: string, options?: IPromptOptions): Promise<string>;
|
|
34
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE/D,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,iBAAiB,CAKzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,iBAAiB,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic readline prompt utility for CLI interactive input.
|
|
4
|
+
*
|
|
5
|
+
* Uses Node's built-in `readline` module to prompt users for input.
|
|
6
|
+
*
|
|
7
|
+
* @module cli/prompt
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createPromptInterface = createPromptInterface;
|
|
11
|
+
exports.askQuestion = askQuestion;
|
|
12
|
+
const readline_1 = require("readline");
|
|
13
|
+
/**
|
|
14
|
+
* Create a readline interface for interactive prompts.
|
|
15
|
+
*
|
|
16
|
+
* @returns A readline interface connected to stdin/stdout
|
|
17
|
+
*/
|
|
18
|
+
function createPromptInterface() {
|
|
19
|
+
return (0, readline_1.createInterface)({
|
|
20
|
+
input: process.stdin,
|
|
21
|
+
output: process.stdout,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Ask the user a question via readline and return their answer.
|
|
26
|
+
*
|
|
27
|
+
* Shows the default value in brackets (e.g., `"Region [canadacentral]: "`).
|
|
28
|
+
* Re-prompts if `required` is true and the answer is empty with no default.
|
|
29
|
+
*
|
|
30
|
+
* @param rl - Readline interface
|
|
31
|
+
* @param question - The question text to display
|
|
32
|
+
* @param options - Prompt options (defaultValue, required)
|
|
33
|
+
* @returns The user's answer or the default value
|
|
34
|
+
*/
|
|
35
|
+
function askQuestion(rl, question, options = {}) {
|
|
36
|
+
const { defaultValue, required } = options;
|
|
37
|
+
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
38
|
+
const prompt = `${question}${suffix}: `;
|
|
39
|
+
return new Promise((resolve) => {
|
|
40
|
+
const ask = () => {
|
|
41
|
+
rl.question(prompt, (answer) => {
|
|
42
|
+
const trimmed = answer.trim();
|
|
43
|
+
if (trimmed) {
|
|
44
|
+
resolve(trimmed);
|
|
45
|
+
}
|
|
46
|
+
else if (defaultValue) {
|
|
47
|
+
resolve(defaultValue);
|
|
48
|
+
}
|
|
49
|
+
else if (required) {
|
|
50
|
+
console.log(" This field is required. Please enter a value.");
|
|
51
|
+
ask();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
resolve("");
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
ask();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/cli/prompt.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAkBH,sDAKC;AAaD,kCA2BC;AA7DD,uCAA2C;AA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|
+
* Contains the minimal-azure, azure, and multi-cloud template generators,
|
|
5
|
+
* split from templates.ts to keep files under the 500-line limit.
|
|
6
|
+
*
|
|
7
|
+
* @module cli/templates-azure
|
|
8
|
+
*/
|
|
9
|
+
import type { ITemplateFiles, ITemplateOptions } from "./templates.js";
|
|
10
|
+
/**
|
|
11
|
+
* Minimal Azure template — state backend + Key Vault, no cluster.
|
|
12
|
+
*
|
|
13
|
+
* @param name - Project name substituted into resource names
|
|
14
|
+
* @param options - Optional template options with Azure configuration
|
|
15
|
+
* @returns Template files
|
|
16
|
+
*/
|
|
17
|
+
export declare function minimalAzureTemplate(name: string, options?: ITemplateOptions): ITemplateFiles;
|
|
18
|
+
/**
|
|
19
|
+
* Full Azure stack — VNet + AKS + Azure DNS + Key Vault + Platform.
|
|
20
|
+
*
|
|
21
|
+
* @param name - Project name substituted into resource names
|
|
22
|
+
* @param options - Optional template options with Azure configuration
|
|
23
|
+
* @returns Template files
|
|
24
|
+
*/
|
|
25
|
+
export declare function azureTemplate(name: string, options?: ITemplateOptions): ITemplateFiles;
|
|
26
|
+
/**
|
|
27
|
+
* Multi-cloud template — AWS + Azure active-active with GLB.
|
|
28
|
+
*
|
|
29
|
+
* @param name - Project name substituted into resource names
|
|
30
|
+
* @param options - Optional template options with Azure configuration
|
|
31
|
+
* @returns Template files
|
|
32
|
+
*/
|
|
33
|
+
export declare function multiCloudTemplate(name: string, options?: ITemplateOptions): ITemplateFiles;
|
|
34
|
+
//# sourceMappingURL=templates-azure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates-azure.d.ts","sourceRoot":"","sources":["../../../src/cli/templates-azure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKvE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAgF7F;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAqKtF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,cAAc,CA4K3F"}
|