saaslayer 0.0.1 → 0.0.2
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/bin/saaslayer.js +6 -6
- package/package.json +6 -3
package/bin/saaslayer.js
CHANGED
|
@@ -28,7 +28,7 @@ const HELP = `saaslayer — SaaSLayer onboarding CLI
|
|
|
28
28
|
Usage:
|
|
29
29
|
saaslayer init --control-plane-account <12-digit> --external-id <secret> [--stack-name NAME]
|
|
30
30
|
[--region REGION] [--stack-name-prefix sl-] [--template PATH] [--dry-run]
|
|
31
|
-
Deploy the
|
|
31
|
+
Deploy the SaaSLayer foundation stack (3 IAM roles + permissions boundary + artifact
|
|
32
32
|
bucket) into the caller's AWS account, trusting the SaaSLayer control plane.
|
|
33
33
|
Uses the bundled templates/host-account.yml. --dry-run validates only.
|
|
34
34
|
|
|
@@ -62,9 +62,9 @@ function cmdInit({ flags }) {
|
|
|
62
62
|
const template = flags.template || path.join(__dirname, '..', 'templates', 'host-account.yml')
|
|
63
63
|
if (!fs.existsSync(template)) throw new Error(`init: template not found at ${template}`)
|
|
64
64
|
const region = flags.region || process.env.AWS_REGION || 'us-east-1'
|
|
65
|
-
// Canonical name —
|
|
66
|
-
//
|
|
67
|
-
const stackName = flags['stack-name'] || 'saaslayer-
|
|
65
|
+
// Canonical name — the account-global named IAM resources allow only one SaaSLayer
|
|
66
|
+
// foundation stack per account, so init always updates the same stack.
|
|
67
|
+
const stackName = flags['stack-name'] || 'saaslayer-foundation'
|
|
68
68
|
if (flags['dry-run']) {
|
|
69
69
|
execFileSync('aws', ['cloudformation', 'validate-template', '--template-body', `file://${template}`, '--region', region], { stdio: 'inherit' })
|
|
70
70
|
console.log(`\n[dry-run] template valid. Would deploy stack "${stackName}" to ${region}.`)
|
|
@@ -78,14 +78,14 @@ function cmdInit({ flags }) {
|
|
|
78
78
|
if (!controlPlaneAccount) throw new Error('init: --control-plane-account <12-digit id> (or $SAASLAYER_CONTROL_PLANE_ACCOUNT) is required')
|
|
79
79
|
if (!/^[0-9]{12}$/.test(controlPlaneAccount)) throw new Error('init: --control-plane-account must be a 12-digit AWS account id')
|
|
80
80
|
if (!externalId) throw new Error('init: --external-id <secret> (or $SAASLAYER_EXTERNAL_ID) is required — shared during onboarding')
|
|
81
|
-
console.log(`Deploying
|
|
81
|
+
console.log(`Deploying SaaSLayer foundation stack "${stackName}" to ${region} (control plane ${controlPlaneAccount})…`)
|
|
82
82
|
execFileSync('aws', [
|
|
83
83
|
'cloudformation', 'deploy', '--template-file', template, '--stack-name', stackName, '--region', region,
|
|
84
84
|
'--capabilities', 'CAPABILITY_NAMED_IAM',
|
|
85
85
|
'--parameter-overrides',
|
|
86
86
|
`ControlPlaneAccountId=${controlPlaneAccount}`, `ExternalId=${externalId}`, `StackNamePrefix=${stackPrefix}`,
|
|
87
87
|
], { stdio: 'inherit' })
|
|
88
|
-
console.log('\
|
|
88
|
+
console.log('\nSaaSLayer foundation deployed.')
|
|
89
89
|
console.log(` • Control plane ${controlPlaneAccount} may now assume the deploy role (ExternalId gated).`)
|
|
90
90
|
console.log(` • It can manage only CloudFormation stacks named "${stackPrefix}*" in this account.`)
|
|
91
91
|
console.log(' • Share the ControlPlaneAccountId + ExternalId with SaaSLayer onboarding to finish setup.')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saaslayer",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "SaaSLayer CLI
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "SaaSLayer CLI — onboard an account (init) and register a service's RBAC manifest.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"saaslayer": "bin/saaslayer.js"
|
|
@@ -40,6 +40,9 @@
|
|
|
40
40
|
"scripts": {
|
|
41
41
|
"test": "node bin/saaslayer.js --help >/dev/null && echo ok",
|
|
42
42
|
"sync-template": "node scripts/sync-template.js",
|
|
43
|
-
"prepublishOnly": "node scripts/sync-template.js"
|
|
43
|
+
"prepublishOnly": "node scripts/sync-template.js",
|
|
44
|
+
"release:patch": "npm version patch && npm publish",
|
|
45
|
+
"release:minor": "npm version minor && npm publish",
|
|
46
|
+
"release:major": "npm version major && npm publish"
|
|
44
47
|
}
|
|
45
48
|
}
|