@beesolve/aws-accounts 1.0.6 → 1.0.7
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/README.md +10 -4
- package/dist/awsConfig.js +1 -2
- package/dist/commands/remote.js +3 -8
- package/dist-lambda/lambda.zip +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,21 +22,27 @@ npm init -y
|
|
|
22
22
|
npm pkg set type=module
|
|
23
23
|
npm install @beesolve/aws-accounts
|
|
24
24
|
|
|
25
|
-
# 2.
|
|
25
|
+
# 2. Initialize git and add a .gitignore
|
|
26
|
+
git init
|
|
27
|
+
echo -e "node_modules/\n.remote-state-cache.json" > .gitignore
|
|
28
|
+
|
|
29
|
+
# 3. Deploy remote infrastructure (S3 bucket, IAM role, Lambda)
|
|
26
30
|
npx aws-accounts bootstrap --region us-east-1
|
|
27
31
|
|
|
28
|
-
#
|
|
32
|
+
# 4. Scan your AWS org and generate aws.config.ts
|
|
29
33
|
npx aws-accounts init
|
|
30
34
|
|
|
31
|
-
#
|
|
35
|
+
# 5. Edit aws.config.ts to model your desired state
|
|
32
36
|
|
|
33
|
-
#
|
|
37
|
+
# 6. Preview and apply changes
|
|
34
38
|
npx aws-accounts plan
|
|
35
39
|
npx aws-accounts apply
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
After `init`, `aws.config.ts` is your source of truth. Edit it to add accounts, move OUs, manage permission sets, and control access — then sync with `plan` / `apply`.
|
|
39
43
|
|
|
44
|
+
> **`.gitignore` recommendation:** Add `node_modules/` and `.remote-state-cache.json` to your `.gitignore`. The cache file is a local copy of remote state that varies per environment and should not be committed.
|
|
45
|
+
|
|
40
46
|
## Commands
|
|
41
47
|
|
|
42
48
|
| Command | Description |
|
package/dist/awsConfig.js
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
} from "@beesolve/iam-policy-ts";
|
|
12
12
|
import {
|
|
13
13
|
createAccessRoleName,
|
|
14
|
-
readStateFile,
|
|
15
14
|
validateState
|
|
16
15
|
} from "./state.js";
|
|
17
16
|
import { assertUnreachable, toRecordByProperty } from "./helpers.js";
|
|
@@ -114,7 +113,7 @@ const moduleDirectoryPath = resolve(
|
|
|
114
113
|
);
|
|
115
114
|
const projectRootPath = resolve(moduleDirectoryPath, "..");
|
|
116
115
|
async function writeAwsConfigFromState(props) {
|
|
117
|
-
const state =
|
|
116
|
+
const state = props.state;
|
|
118
117
|
const context = await readAwsContextFile(props.contextPath);
|
|
119
118
|
assertStateMatchesContext({
|
|
120
119
|
state,
|
package/dist/commands/remote.js
CHANGED
|
@@ -398,7 +398,6 @@ async function runRemoteScan(input) {
|
|
|
398
398
|
await writeStateCache(cachePath, response.state);
|
|
399
399
|
input.logger.log("State cache updated.");
|
|
400
400
|
}
|
|
401
|
-
const statePath = "state.json";
|
|
402
401
|
async function runRemoteInit(input) {
|
|
403
402
|
const deployment = await readDeploymentFromContext();
|
|
404
403
|
input.logger.log("Invoking remote scan...");
|
|
@@ -421,12 +420,8 @@ async function runRemoteInit(input) {
|
|
|
421
420
|
input.logger.log(` Groups: ${response.summary.groups}`);
|
|
422
421
|
input.logger.log(` Permission Sets: ${response.summary.permissionSets}`);
|
|
423
422
|
input.logger.log(` Account Assignments: ${response.summary.accountAssignments}`);
|
|
424
|
-
await
|
|
425
|
-
|
|
426
|
-
`, "utf8"),
|
|
427
|
-
writeStateCache(cachePath, response.state)
|
|
428
|
-
]);
|
|
429
|
-
input.logger.log("State written to state.json and cache updated.");
|
|
423
|
+
await writeStateCache(cachePath, response.state);
|
|
424
|
+
input.logger.log("State cache updated.");
|
|
430
425
|
const context = await readAwsContextFromFile(contextFilePath);
|
|
431
426
|
const graveyardOu = response.state.organization.organizationalUnits.find(
|
|
432
427
|
(ou) => ou.name === "Graveyard"
|
|
@@ -453,7 +448,7 @@ async function runRemoteInit(input) {
|
|
|
453
448
|
await writeFile(contextFilePath, `${JSON.stringify(ordered, null, 2)}
|
|
454
449
|
`, "utf8");
|
|
455
450
|
const configWriteResult = await writeAwsConfigFromState({
|
|
456
|
-
|
|
451
|
+
state: response.state,
|
|
457
452
|
contextPath: contextFilePath,
|
|
458
453
|
configPath: configFilePath,
|
|
459
454
|
typesPath: typesFilePath,
|
package/dist-lambda/lambda.zip
CHANGED
|
Binary file
|