@huawei-iac-tools/landingzone-workbench 0.0.0-stage → 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.
Files changed (246) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +85 -2
  3. package/cordis.patch.yml +21 -0
  4. package/knowledge/account-qualification.md +128 -0
  5. package/knowledge/blueprints/_base/blueprint.json +481 -0
  6. package/knowledge/blueprints/_base/defaults.json +127 -0
  7. package/knowledge/blueprints/foundation-lz/blueprint.json +43 -0
  8. package/knowledge/blueprints/foundation-lz/defaults.json +47 -0
  9. package/knowledge/blueprints/full-lz/blueprint.json +11 -0
  10. package/knowledge/blueprints/full-lz/defaults.json +8 -0
  11. package/knowledge/config.json +43 -0
  12. package/knowledge/error-rules.json +14 -0
  13. package/knowledge/ic-policies.json +21 -0
  14. package/knowledge/modules/account-structure.md +101 -0
  15. package/knowledge/modules/compliance/config-rms.md +212 -0
  16. package/knowledge/modules/compliance/cts.md +179 -0
  17. package/knowledge/modules/compliance/obs-lts.md +155 -0
  18. package/knowledge/modules/ic-policies.json +21 -0
  19. package/knowledge/modules/identity-center.md +603 -0
  20. package/knowledge/modules/module-layers.md +169 -0
  21. package/knowledge/modules/network/er.md +222 -0
  22. package/knowledge/modules/network/nat-eip.md +123 -0
  23. package/knowledge/modules/network/ram-share.md +92 -0
  24. package/knowledge/modules/network/vpc-subnet.md +142 -0
  25. package/knowledge/modules/organization-security/scp.md +122 -0
  26. package/knowledge/modules/organizations.md +212 -0
  27. package/knowledge/modules/recommended-config.md +157 -0
  28. package/knowledge/modules/recommended-rules.json +175 -0
  29. package/knowledge/modules/scp-policies.json +111 -0
  30. package/knowledge/modules/security/aad.md +94 -0
  31. package/knowledge/modules/security/cfw.md +105 -0
  32. package/knowledge/modules/security/waf.md +110 -0
  33. package/knowledge/param-mappings.json +133 -0
  34. package/knowledge/prompts.md +83 -0
  35. package/knowledge/resource-types.json +1162 -0
  36. package/knowledge/scp-policies.json +111 -0
  37. package/knowledge/state-machine.md +33 -0
  38. package/lib/client.js +21 -0
  39. package/lib/index.js +28592 -0
  40. package/lib/types/account-role.d.ts +19 -0
  41. package/lib/types/account-scope.d.ts +10 -0
  42. package/lib/types/agency.d.ts +38 -0
  43. package/lib/types/client/DropdownSelect.d.ts +49 -0
  44. package/lib/types/client/LoginGate.d.ts +20 -0
  45. package/lib/types/client/PanelIcon.d.ts +11 -0
  46. package/lib/types/client/WorkbenchShell.d.ts +21 -0
  47. package/lib/types/client/account-role.d.ts +15 -0
  48. package/lib/types/client/credential-status.d.ts +15 -0
  49. package/lib/types/client/huawei-mark.d.ts +37 -0
  50. package/lib/types/client/index.d.ts +26 -0
  51. package/lib/types/client/layout-ref.d.ts +23 -0
  52. package/lib/types/client/pages/ConfigPage/AdviceCard.d.ts +26 -0
  53. package/lib/types/client/pages/ConfigPage/AuditBar.d.ts +21 -0
  54. package/lib/types/client/pages/ConfigPage/ChangeSummaryCard.d.ts +22 -0
  55. package/lib/types/client/pages/ConfigPage/ChangesCard.d.ts +27 -0
  56. package/lib/types/client/pages/ConfigPage/ComplianceDetail.d.ts +25 -0
  57. package/lib/types/client/pages/ConfigPage/ComplianceSummaryCard.d.ts +31 -0
  58. package/lib/types/client/pages/ConfigPage/FindingsCard.d.ts +21 -0
  59. package/lib/types/client/pages/ConfigPage/GlossaryDrawer.d.ts +17 -0
  60. package/lib/types/client/pages/ConfigPage/OrgComplianceDetail.d.ts +15 -0
  61. package/lib/types/client/pages/ConfigPage/Pager.d.ts +32 -0
  62. package/lib/types/client/pages/ConfigPage/ResourceDrawer.d.ts +26 -0
  63. package/lib/types/client/pages/ConfigPage/ResourcesTable.d.ts +35 -0
  64. package/lib/types/client/pages/ConfigPage/RollupPanel.d.ts +17 -0
  65. package/lib/types/client/pages/ConfigPage/RuleDetailDrawer.d.ts +23 -0
  66. package/lib/types/client/pages/ConfigPage/StatusCards.d.ts +26 -0
  67. package/lib/types/client/pages/ConfigPage/UncoveredDialog.d.ts +22 -0
  68. package/lib/types/client/pages/ConfigPage/config-api.d.ts +101 -0
  69. package/lib/types/client/pages/ConfigPage/config-store.d.ts +57 -0
  70. package/lib/types/client/pages/ConfigPage/index.d.ts +21 -0
  71. package/lib/types/client/pages/ConfigPage/paging.d.ts +46 -0
  72. package/lib/types/client/pages/ConfigPage/scope-options.d.ts +51 -0
  73. package/lib/types/client/pages/CostPage/AccountAllocation.d.ts +24 -0
  74. package/lib/types/client/pages/CostPage/AccountBars.d.ts +20 -0
  75. package/lib/types/client/pages/CostPage/AccountColumns.d.ts +24 -0
  76. package/lib/types/client/pages/CostPage/AccountDonut.d.ts +18 -0
  77. package/lib/types/client/pages/CostPage/AccountSwitcher.d.ts +25 -0
  78. package/lib/types/client/pages/CostPage/AdviceCard.d.ts +43 -0
  79. package/lib/types/client/pages/CostPage/AdviceFindings.d.ts +43 -0
  80. package/lib/types/client/pages/CostPage/BillingPanels.d.ts +23 -0
  81. package/lib/types/client/pages/CostPage/BudgetCard.d.ts +36 -0
  82. package/lib/types/client/pages/CostPage/GlossaryDrawer.d.ts +16 -0
  83. package/lib/types/client/pages/CostPage/KpiRow.d.ts +23 -0
  84. package/lib/types/client/pages/CostPage/MarkdownBlock.d.ts +16 -0
  85. package/lib/types/client/pages/CostPage/ReportView.d.ts +17 -0
  86. package/lib/types/client/pages/CostPage/ResourceColumns.d.ts +19 -0
  87. package/lib/types/client/pages/CostPage/ResourceDonut.d.ts +18 -0
  88. package/lib/types/client/pages/CostPage/ResourcesCard.d.ts +40 -0
  89. package/lib/types/client/pages/CostPage/RuleDetailDrawer.d.ts +23 -0
  90. package/lib/types/client/pages/CostPage/SavingView.d.ts +38 -0
  91. package/lib/types/client/pages/CostPage/ServiceDonut.d.ts +17 -0
  92. package/lib/types/client/pages/CostPage/TrendChart.d.ts +24 -0
  93. package/lib/types/client/pages/CostPage/budget-input.d.ts +30 -0
  94. package/lib/types/client/pages/CostPage/cost-api.d.ts +266 -0
  95. package/lib/types/client/pages/CostPage/cost-store.d.ts +25 -0
  96. package/lib/types/client/pages/CostPage/format.d.ts +37 -0
  97. package/lib/types/client/pages/CostPage/index.d.ts +34 -0
  98. package/lib/types/client/pages/CostPage/trend-fold.d.ts +32 -0
  99. package/lib/types/client/pages/CostPage/useEcharts.d.ts +70 -0
  100. package/lib/types/client/pages/OrgStructurePage/AccountStatsCard.d.ts +22 -0
  101. package/lib/types/client/pages/OrgStructurePage/CoreAccountsCard.d.ts +18 -0
  102. package/lib/types/client/pages/OrgStructurePage/CreateAccountDialog.d.ts +28 -0
  103. package/lib/types/client/pages/OrgStructurePage/ManageUsersDialog.d.ts +28 -0
  104. package/lib/types/client/pages/OrgStructurePage/MemberAccountsTable.d.ts +32 -0
  105. package/lib/types/client/pages/OrgStructurePage/MoveAccountDialog.d.ts +29 -0
  106. package/lib/types/client/pages/OrgStructurePage/OrgGlossaryDrawer.d.ts +13 -0
  107. package/lib/types/client/pages/OrgStructurePage/OrgTreeCard.d.ts +31 -0
  108. package/lib/types/client/pages/OrgStructurePage/index.d.ts +21 -0
  109. package/lib/types/client/pages/OrgStructurePage/org-api.d.ts +166 -0
  110. package/lib/types/client/pages/OverviewPage/AnchorRow.d.ts +24 -0
  111. package/lib/types/client/pages/OverviewPage/AttentionList.d.ts +29 -0
  112. package/lib/types/client/pages/OverviewPage/OverviewCharts.d.ts +79 -0
  113. package/lib/types/client/pages/OverviewPage/OverviewGlossaryDrawer.d.ts +15 -0
  114. package/lib/types/client/pages/OverviewPage/index.d.ts +22 -0
  115. package/lib/types/client/pages/OverviewPage/overview-api.d.ts +115 -0
  116. package/lib/types/client/pages/ResourcePage/AccountResourceList.d.ts +21 -0
  117. package/lib/types/client/pages/ResourcePage/components/GlossaryDrawer.d.ts +20 -0
  118. package/lib/types/client/pages/ResourcePage/components/MetricCards.d.ts +19 -0
  119. package/lib/types/client/pages/ResourcePage/components/MultiSelect.d.ts +27 -0
  120. package/lib/types/client/pages/ResourcePage/components/PanelPager.d.ts +26 -0
  121. package/lib/types/client/pages/ResourcePage/components/RankBars.d.ts +25 -0
  122. package/lib/types/client/pages/ResourcePage/components/ScopeSelect.d.ts +27 -0
  123. package/lib/types/client/pages/ResourcePage/components/SourceConfigModal.d.ts +21 -0
  124. package/lib/types/client/pages/ResourcePage/components/SyncControls.d.ts +18 -0
  125. package/lib/types/client/pages/ResourcePage/components/TrendChart.d.ts +14 -0
  126. package/lib/types/client/pages/ResourcePage/components/useColumnWidths.d.ts +12 -0
  127. package/lib/types/client/pages/ResourcePage/format.d.ts +9 -0
  128. package/lib/types/client/pages/ResourcePage/index.d.ts +20 -0
  129. package/lib/types/client/pages/ResourcePage/summary-api.d.ts +205 -0
  130. package/lib/types/client/pages/SetupPage/AskPanel.d.ts +21 -0
  131. package/lib/types/client/pages/SetupPage/ChatEmbed.d.ts +40 -0
  132. package/lib/types/client/pages/SetupPage/ChatTab.d.ts +17 -0
  133. package/lib/types/client/pages/SetupPage/FormTab.d.ts +12 -0
  134. package/lib/types/client/pages/SetupPage/FormTabV2.d.ts +14 -0
  135. package/lib/types/client/pages/SetupPage/ProgressTreeView.d.ts +15 -0
  136. package/lib/types/client/pages/SetupPage/StageFlow.d.ts +16 -0
  137. package/lib/types/client/pages/SetupPage/index.d.ts +10 -0
  138. package/lib/types/client/pages/SetupPage/progress-types.d.ts +36 -0
  139. package/lib/types/client/pages/SetupPage/session-binding.d.ts +38 -0
  140. package/lib/types/client/pages/SetupPage/session-store.d.ts +57 -0
  141. package/lib/types/client/pages/SetupPage/sessions-ref.d.ts +5 -0
  142. package/lib/types/client/pages/SetupPage/setup-replan.d.ts +13 -0
  143. package/lib/types/client/pages/SetupPage/wb-api.d.ts +192 -0
  144. package/lib/types/client/pages/list-preview.d.ts +36 -0
  145. package/lib/types/client/permission-mode.d.ts +53 -0
  146. package/lib/types/client/store.d.ts +22 -0
  147. package/lib/types/collect.d.ts +78 -0
  148. package/lib/types/config/account-scope.d.ts +61 -0
  149. package/lib/types/config/advice-findings.d.ts +31 -0
  150. package/lib/types/config/advice-prompt.d.ts +60 -0
  151. package/lib/types/config/advice.d.ts +116 -0
  152. package/lib/types/config/cts.d.ts +30 -0
  153. package/lib/types/config/evidence/rules.d.ts +31 -0
  154. package/lib/types/config/evidence/types.d.ts +103 -0
  155. package/lib/types/config/failure-note.d.ts +46 -0
  156. package/lib/types/config/fingerprint-cache.d.ts +45 -0
  157. package/lib/types/config/identity.d.ts +67 -0
  158. package/lib/types/config/query.d.ts +49 -0
  159. package/lib/types/config/rms.d.ts +412 -0
  160. package/lib/types/config/routes.d.ts +32 -0
  161. package/lib/types/config/types.d.ts +785 -0
  162. package/lib/types/config/views.d.ts +158 -0
  163. package/lib/types/cost/accounts.d.ts +29 -0
  164. package/lib/types/cost/advice-findings.d.ts +77 -0
  165. package/lib/types/cost/advice-model.d.ts +19 -0
  166. package/lib/types/cost/advice-prompt.d.ts +73 -0
  167. package/lib/types/cost/advice-subagent-types.d.ts +6 -0
  168. package/lib/types/cost/advice-subagent.d.ts +116 -0
  169. package/lib/types/cost/advice-types.d.ts +63 -0
  170. package/lib/types/cost/advice.d.ts +125 -0
  171. package/lib/types/cost/aggregate.d.ts +157 -0
  172. package/lib/types/cost/assume.d.ts +43 -0
  173. package/lib/types/cost/bss.d.ts +166 -0
  174. package/lib/types/cost/budget-overview.d.ts +38 -0
  175. package/lib/types/cost/budget.d.ts +56 -0
  176. package/lib/types/cost/cache.d.ts +58 -0
  177. package/lib/types/cost/caliber.d.ts +40 -0
  178. package/lib/types/cost/console-links.d.ts +27 -0
  179. package/lib/types/cost/credentials.d.ts +38 -0
  180. package/lib/types/cost/data-window.d.ts +38 -0
  181. package/lib/types/cost/evidence/catalog.d.ts +35 -0
  182. package/lib/types/cost/evidence/index.d.ts +70 -0
  183. package/lib/types/cost/evidence/inventory.d.ts +44 -0
  184. package/lib/types/cost/evidence/pricing.d.ts +72 -0
  185. package/lib/types/cost/evidence/projects.d.ts +18 -0
  186. package/lib/types/cost/evidence/rules.d.ts +66 -0
  187. package/lib/types/cost/evidence/state.d.ts +38 -0
  188. package/lib/types/cost/evidence/thresholds.d.ts +68 -0
  189. package/lib/types/cost/evidence/types.d.ts +288 -0
  190. package/lib/types/cost/evidence/utilization.d.ts +37 -0
  191. package/lib/types/cost/history.d.ts +36 -0
  192. package/lib/types/cost/ledger.d.ts +97 -0
  193. package/lib/types/cost/normalize.d.ts +37 -0
  194. package/lib/types/cost/period-projection.d.ts +57 -0
  195. package/lib/types/cost/plan-check.d.ts +102 -0
  196. package/lib/types/cost/plan-db.d.ts +73 -0
  197. package/lib/types/cost/plan-types.d.ts +183 -0
  198. package/lib/types/cost/plan.d.ts +63 -0
  199. package/lib/types/cost/quote.d.ts +45 -0
  200. package/lib/types/cost/report.d.ts +136 -0
  201. package/lib/types/cost/resources.d.ts +108 -0
  202. package/lib/types/cost/routes.d.ts +38 -0
  203. package/lib/types/cost/scope.d.ts +42 -0
  204. package/lib/types/cost/types.d.ts +335 -0
  205. package/lib/types/cost/unit-prices-derive.d.ts +19 -0
  206. package/lib/types/cost/unit-prices.d.ts +23 -0
  207. package/lib/types/db.d.ts +228 -0
  208. package/lib/types/host-log.d.ts +7 -0
  209. package/lib/types/http.d.ts +42 -0
  210. package/lib/types/index.d.ts +30 -0
  211. package/lib/types/inventory.d.ts +286 -0
  212. package/lib/types/obs.d.ts +16 -0
  213. package/lib/types/org/aggregate.d.ts +36 -0
  214. package/lib/types/org/churn.d.ts +10 -0
  215. package/lib/types/org/orgs.d.ts +258 -0
  216. package/lib/types/org/routes.d.ts +28 -0
  217. package/lib/types/org-types.d.ts +156 -0
  218. package/lib/types/per-service.d.ts +39 -0
  219. package/lib/types/setup/blueprint-loader.d.ts +81 -0
  220. package/lib/types/setup/caller.d.ts +105 -0
  221. package/lib/types/setup/engine.d.ts +41 -0
  222. package/lib/types/setup/form-store.d.ts +13 -0
  223. package/lib/types/setup/nodes/n1-check.d.ts +14 -0
  224. package/lib/types/setup/nodes/n10-governance.d.ts +6 -0
  225. package/lib/types/setup/nodes/n11-infra.d.ts +6 -0
  226. package/lib/types/setup/nodes/n12-reconcile.d.ts +6 -0
  227. package/lib/types/setup/nodes/n2-region.d.ts +6 -0
  228. package/lib/types/setup/nodes/n3-blueprint.d.ts +6 -0
  229. package/lib/types/setup/nodes/n4-modules.d.ts +6 -0
  230. package/lib/types/setup/nodes/n5-details.d.ts +6 -0
  231. package/lib/types/setup/nodes/n6-plan.d.ts +6 -0
  232. package/lib/types/setup/nodes/n7-verify.d.ts +6 -0
  233. package/lib/types/setup/nodes/n8-approve.d.ts +6 -0
  234. package/lib/types/setup/nodes/n9-buildmode.d.ts +6 -0
  235. package/lib/types/setup/plan-state.d.ts +10 -0
  236. package/lib/types/setup/prompt-loader.d.ts +16 -0
  237. package/lib/types/setup/routes.d.ts +22 -0
  238. package/lib/types/setup/session-notify.d.ts +30 -0
  239. package/lib/types/setup/tools.d.ts +19 -0
  240. package/lib/types/setup/types.d.ts +157 -0
  241. package/lib/types/sse-bus.d.ts +23 -0
  242. package/lib/types/tools/config-facts.d.ts +16 -0
  243. package/lib/types/tools/cost-facts.d.ts +10 -0
  244. package/lib/types/tools/register.d.ts +18 -0
  245. package/lib/types/wb-conventions.d.ts +140 -0
  246. package/package.json +77 -4
@@ -0,0 +1,142 @@
1
+ # VPC 与子网(vpc-subnet)
2
+
3
+ > VPC 是业务账号内的虚拟网络,子网是 VPC 内的网段划分。
4
+ > 网络块的基础——ER/NAT/EIP 都挂在 VPC/子网上。
5
+
6
+ ---
7
+
8
+ ## 一、是什么 / 为什么需要
9
+
10
+ VPC(Virtual Private Cloud)提供账号内隔离的虚拟网络。子网(Subnet)是 VPC 内的 IP 网段,资源(ECS/ER/NAT)挂到子网获得网络。
11
+
12
+ **为什么需要**:账号间网络隔离靠 VPC;账号内资源隔离靠子网;ER 接入需专用子网。
13
+
14
+ ## 二、里面应该有什么(子结构)
15
+
16
+ | 资源 | 职责 | 必备 |
17
+ |---|---|---|
18
+ | VPC | 账号级虚拟网络 | ✅ |
19
+ | ER 接入子网 | 供 ER attachment 挂接(通常 /29) | 多VPC+ER 时必备 |
20
+ | 业务子网 | 跑业务资源(通常 /22) | ✅ |
21
+
22
+ ### 标准 LZ 的 VPC 规划
23
+
24
+ | 账号 | VPC | 网段 | 用途 |
25
+ |---|---|---|---|
26
+ | SharedServices | vpc-dmz | 10.0.0.0/16 | DMZ/共享/ER hub |
27
+ | Dev | vpc-development | 10.1.0.0/16 | 测试 |
28
+ | Prod | vpc-production | 10.2.0.0/16 | 生产 |
29
+ | Ops | vpc-management | 10.3.0.0/16 | 运维 |
30
+
31
+ ## 三、注意点 / 最佳实践 / 坑
32
+
33
+ ### 约束
34
+ - **VPC/子网是区域服务**,host 带 `vpc.<region>.`
35
+ - **子网需指定可用区(AZ)**:如 cn-north-4a/b;**不同区域 AZ 命名不同,必须动态查**(apiexplorer 查 AZ,或 DescribeAvailabilityZones),不能硬编码
36
+ - **网段不能重叠**:跨账号 VPC 经 ER 互通,网段重叠会路由冲突
37
+
38
+ ### 最佳实践
39
+ - ER 接入子网用 /29(只需几个 IP 给 ER),业务子网用 /22(够业务用)
40
+ - 每账号至少 2 个 AZ 的子网(高可用)
41
+
42
+ ### 坑
43
+ - **可用区硬编码是 bug 源**:cn-north-4 有 a/b,但有的区域是 a/b/c/d,有的只有 2 个——换区域必查
44
+ - **子网 CIDR 要从 VPC CIDR 切分**:不能超出 VPC 网段
45
+
46
+ ## 三·五、费用属性(版本基价,沟通口径)
47
+
48
+ > VPC 与子网为**免费资源**(2026-11-12 确认):创建与持有不产生费用。
49
+ > 关联费用来自挂载其上的付费项:EIP(公网出口)、NAT 网关、ER(跨 VPC 互通)——
50
+ > 分别见 nat-eip.md / er.md 的费用属性。方案费用预估中 VPC/子网按 0 元计。
51
+
52
+ ## 四、创建依赖
53
+
54
+ ### 前置
55
+ - **成员账号已建**(VPC 建在账号内,需 assume 跨账号)
56
+ - **assume 依赖 OrganizationAccountAccessAgency**(账号创建自动获得)
57
+
58
+ ### 被依赖
59
+ - ER attachment 依赖 VPC(子网)
60
+ - NAT 依赖 VPC + 子网
61
+ - 业务资源(ECS)依赖子网
62
+
63
+ ## 五、怎么查接口(指向 ops-deploy)
64
+
65
+ | 查什么 | productshort | 关键 API |
66
+ |---|---|---|
67
+ | VPC | VPC | CreateVpc / ListVpcs |
68
+ | 子网 | VPC | CreateSubnet / ListSubnets |
69
+ | 可用区 | ECS 或 Nova | ListAvailabilityZones(查 AZ,避免硬编码) |
70
+
71
+ **查法**:`apiexplorer('VPC')` → compact 查契约 → `apiexplorerHost('VPC', region)` 查 host(区域服务)。
72
+ > VPC 接口 path 多含 `{project_id}`,需 assume 后查成员账号的 project_id 替换。
73
+
74
+ ### 特殊参数(模板表 specialParams 对应)
75
+
76
+ | 参数字段 | resolver | 说明 |
77
+ |---|---|---|
78
+ | `cidr` | from-spec | 从 spec.network 取(如 devVpcCidr),子网从 VPC cidr 切分 |
79
+ | `availability_zone` | query-az | **必须动态查** ListAvailabilityZones,取 region 前 2 个 AZ,绝不写死 |
80
+ | `vpc_id` | from-prior-resource | 从前置 vpc 资源创建结果取 |
81
+ | `project_id` | assume-query-project | assume 后查成员账号 project_id(IAM ListProjects) |
82
+
83
+ > ⚠️ `availability_zone` 是最大的坑:旧代码硬编码 cn-north-4a/b,换区域必失败。必须 query-az 动态查。
84
+
85
+ ## 六、资源探测指引
86
+
87
+ > ⚠️ 本节定义该资源如何探测是否已存在。
88
+ > VPC/子网是成员账号资源,探测需 assume 进归属账号(拿临时凭据签名)。
89
+ > path 含 {project_id},需先 query-project 查成员账号的 project_id。
90
+
91
+ ```json
92
+ {
93
+ "probes": [
94
+ {
95
+ "typeId": "vpc",
96
+ "service": "VPC",
97
+ "hostMode": "regional",
98
+ "steps": [
99
+ { "step": 1, "action": "query-host", "productshort": "VPC", "via": "apiexplorerHost", "output": "host" },
100
+ { "step": 2, "action": "query-project", "output": "projectId", "save": true, "depends": ["host"] },
101
+ { "step": 3, "action": "query-list", "method": "GET", "api": "ListVpcs", "path": "/v1/{projectId}/vpcs", "hostKey": "host", "output": "vpcs", "save": true, "depends": ["host", "projectId"] }
102
+ ],
103
+ "match": { "field": "vpcs[].cidr", "expect": "equals-semanticParam", "semField": "cidr" },
104
+ "existsStatus": "historical_exists",
105
+ "existsDetail": "VPC(cidr={cidr})已存在,复用",
106
+ "pendingDetail": "VPC(cidr={cidr})未创建,待建"
107
+ },
108
+ {
109
+ "typeId": "subnet",
110
+ "service": "VPC",
111
+ "hostMode": "regional",
112
+ "steps": [
113
+ { "step": 1, "action": "query-host", "productshort": "VPC", "via": "apiexplorerHost", "output": "host" },
114
+ { "step": 2, "action": "query-project", "output": "projectId", "save": true, "depends": ["host"] },
115
+ { "step": 3, "action": "query-list", "method": "GET", "api": "ListSubnets", "path": "/v1/{projectId}/subnets", "hostKey": "host", "output": "subnets", "save": true, "depends": ["host", "projectId"] }
116
+ ],
117
+ "match": { "field": "subnets[].cidr", "expect": "equals-semanticParam", "semField": "cidr" },
118
+ "existsStatus": "historical_exists",
119
+ "existsDetail": "子网(cidr={cidr})已存在,复用",
120
+ "pendingDetail": "子网(cidr={cidr})未创建,待建"
121
+ }
122
+ ]
123
+ }
124
+ ```
125
+
126
+ > 字段说明:
127
+ > - VPC/子网是区域服务,hostMode=regional(host 带 `<region>.`)
128
+ > - query-project:用 assumed.getProjectId(region) 查成员账号 project_id(IAM ListProjects)
129
+ > - path 的 {projectId} 占位:运行时用 query-project 步骤的 output 填换
130
+ > - match:VPC 按 cidr 匹配(精确),子网也按 cidr 匹配
131
+
132
+ ## 七、演示示例
133
+
134
+ ```
135
+ Dev 账号 VPC:
136
+ name: vpc-bj-development, cidr: 10.1.0.0/16
137
+ ER 接入子网 A: subnet-bj-dev-a, 10.1.0.8/29, az: cn-north-4a
138
+ ER 接入子网 B: subnet-bj-dev-b, 10.1.0.16/29, az: cn-north-4b
139
+ 业务子网 A: subnet-bj-dev-a-1, 10.1.4.0/22, az: cn-north-4a
140
+ 业务子网 B: subnet-bj-dev-b-1, 10.1.8.0/22, az: cn-north-4b
141
+ ```
142
+ > 注:`bj` 前缀是历史残留,生产应按 region 推导或去掉。
@@ -0,0 +1,122 @@
1
+ # 服务控制策略 SCP(organization-security/scp)
2
+
3
+ > Organizations 的服务控制策略(SCP),组织级安全护栏。
4
+ > 用户在 moduleDetail 选策略+content+绑定实体,deriveScp 生成实例。
5
+
6
+ ---
7
+
8
+ ## 一、是什么 / 为什么需要
9
+
10
+ SCP(Service Control Policy)是华为云 Organizations 的组织级策略,对组织内的账号施加权限护栏(Allow/Deny)。
11
+ **为什么需要**:LZ 搭建后,需用 SCP 防止误操作(如删日志账号/开高危端口),是组织级安全治理的手段。
12
+
13
+ ## 二、里面应该有什么(子结构)
14
+
15
+ | 资源 | 职责 | 必备 | 路径 |
16
+ |---|---|---|---|
17
+ | scp_policy_type_enable | 启用 SCP 策略类型(EnablePolicyType) | ✅ | A |
18
+ | scp_policy | 创建 SCP 策略(CreatePolicy) | ✅ | A |
19
+ | scp_policy_attach | 绑定策略到实体(AttachPolicy) | ✅ | A |
20
+
21
+ ## 三、注意点 / 最佳实践 / 坑
22
+
23
+ ### 约束
24
+ - **SCP 类型需先启用**:root 的 policy_types 里 service_control_policy 需为 enabled。由 scp_policy_type_enable 资源自动处理(EnablePolicyType),探测时已 enabled 则标 exists 跳过
25
+ - **策略 content 是 JSON 字符串**:CreatePolicy 的 body 里 content 字段是 string 类型(不是 object)
26
+ - **绑定实体**:root(全组织)/ OU(部分账号)/ 账号(单个),entity_id 从 ListRoots/ListOrganizationalUnits 查
27
+ - **策略名全局唯一**:重名会失败,需探测已有策略(ListPolicies)
28
+
29
+ ### 规则记录(例外条件)
30
+ - SCP 支持 Condition 的 `ForAnyValue:StringNotEquals` 排除特定账号(如 `g:DomainName != 某账号` 可绕过 Deny)
31
+ - LZ 推荐策略**默认不含例外**(全员生效)
32
+ - 用户可在 moduleDetail 自定义 content 添加例外条件
33
+ - 参考:已有策略 SecurityGroupDenyHighRiskPort 用 `g:DomainName` 排除了 `es_workload_ai1shell_manager` 账号
34
+
35
+ ### 坑
36
+ - **CreatePolicy 返回 201**(不是 200),body 含 `policy.policy_summary.id`(AttachPolicy 需要)
37
+ - **AttachPolicy 的 path 含 policy_id**:`/v1/organizations/policies/{policy_id}/attach`
38
+ - **SCP 是 Deny 优先**:即使有 FullAccess,Deny 的 SCP 仍生效
39
+
40
+ ## 四、创建依赖
41
+
42
+ ### 前置
43
+ - **Organization 已建**(SCP 挂在组织下)
44
+
45
+ ### 被依赖
46
+ - scp_policy_attach 依赖 scp_policy(先创建策略拿 id,再绑定)+ scp_policy_type_enable(确保策略类型已启用)
47
+
48
+ ## 五、怎么查接口(指向 ops-deploy)
49
+
50
+ | 查什么 | productshort | 关键 API |
51
+ |---|---|---|
52
+ | 创建策略 | Organizations | CreatePolicy(POST /v1/organizations/policies) |
53
+ | 绑定策略 | Organizations | AttachPolicy(POST /v1/organizations/policies/{policy_id}/attach) |
54
+ | 查策略列表 | Organizations | ListPolicies(GET /v1/organizations/policies) |
55
+ | 查策略详情 | Organizations | ShowPolicy(GET /v1/organizations/policies/{policy_id}) |
56
+ | 查绑定实体 | Organizations | ListEntitiesForPolicy(GET /v1/organizations/policies/{policy_id}/attached-entities) |
57
+ | 启用策略类型 | Organizations | EnablePolicyType(POST /v1/organizations/policy-types/enable) |
58
+ | 查根(含 policy_types 状态) | Organizations | ListRoots(GET /v1/organizations/roots) |
59
+
60
+ **查法**:`apiexplorer('Organizations')` → `apiexplorer('Organizations', apiName, compact=true)` → `endpoints=true`。
61
+ > Organizations 是全局服务,host 不带区域前缀(`organizations.myhuaweicloud.com`)。
62
+
63
+ ## 六、资源探测指引
64
+
65
+ > 格式对齐 organizations.md 的 probes 块。probe-loader 按 TYPE_TO_DOC 映射读此块。
66
+
67
+ ```json
68
+ {
69
+ "probes": [
70
+ {
71
+ "typeId": "scp_policy_type_enable",
72
+ "service": "Organizations",
73
+ "hostMode": "global",
74
+ "steps": [
75
+ { "step": 1, "action": "query-host", "productshort": "Organizations", "via": "apiexplorerHost", "output": "host" },
76
+ { "step": 2, "action": "query-list", "method": "GET", "api": "ListRoots", "path": "/v1/organizations/roots", "output": "roots", "save": true, "depends": ["host"] }
77
+ ],
78
+ "match": { "field": "roots[0].policy_types[?(@.type=='service_control_policy')].status", "expect": "equals-value", "value": "enabled" },
79
+ "existsStatus": "historical_exists",
80
+ "existsDetail": "SCP 策略类型(service_control_policy)已启用,复用",
81
+ "pendingDetail": "SCP 策略类型(service_control_policy)未启用,待启用(EnablePolicyType)"
82
+ },
83
+ {
84
+ "typeId": "scp_policy",
85
+ "service": "Organizations",
86
+ "hostMode": "global",
87
+ "steps": [
88
+ { "step": 1, "action": "query-host", "productshort": "Organizations", "via": "apiexplorerHost", "output": "host" },
89
+ { "step": 2, "action": "query-list", "method": "GET", "api": "ListPolicies", "path": "/v1/organizations/policies", "output": "policies", "save": true, "depends": ["host"] }
90
+ ],
91
+ "match": { "field": "policies[].name", "expect": "equals-semanticParam", "semField": "name", "filter": "type === 'service_control_policy'" },
92
+ "existsStatus": "historical_exists",
93
+ "existsDetail": "SCP 策略 {name} 已存在,复用",
94
+ "pendingDetail": "SCP 策略 {name} 未创建,待建"
95
+ },
96
+ {
97
+ "typeId": "scp_policy_attach",
98
+ "service": "Organizations",
99
+ "hostMode": "global",
100
+ "steps": [
101
+ { "step": 1, "action": "query-host", "productshort": "Organizations", "via": "apiexplorerHost", "output": "host" },
102
+ { "step": 2, "action": "query-list", "method": "GET", "api": "ListEntitiesForPolicy", "path": "/v1/organizations/policies/{policyId}/attached-entities", "hostKey": "host", "output": "attached_entities", "save": true, "depends": ["host"],
103
+ "paramSources": {
104
+ "policyId": { "source": "priorResult", "resourceId": "policyIdRef", "field": "cloudId" }
105
+ }
106
+ }
107
+ ],
108
+ "match": { "field": "attached_entities", "expect": "exists-non-empty" },
109
+ "existsStatus": "historical_exists",
110
+ "existsDetail": "策略 {policyIdRef} 已绑定到实体,复用",
111
+ "pendingDetail": "策略 {policyIdRef} 未绑定,待建"
112
+ }
113
+ ]
114
+ }
115
+ ```
116
+
117
+ ## 七、演示示例
118
+
119
+ ```
120
+ 策略1: DenyHighRiskPortsIngress (禁止公网入方向高危端口,绑定 root)
121
+ 策略2: DenyDeleteLogArchive (禁止删除组织内成员账号,绑定 root)
122
+ ```
@@ -0,0 +1,212 @@
1
+ # 组织服务(organizations)
2
+
3
+ > Organizations 是 LZ 一切的根——管 Organization/OU/账号/可信服务/委托管理员。
4
+ > 没有组织,后面所有块都无法落地。
5
+
6
+ ---
7
+
8
+ ## 一、是什么 / 为什么需要
9
+
10
+ 华为云 Organizations 提供多账号管理容器。一套 LZ 的所有账号、OU、组织级配置都挂在一个 Organization 下。
11
+
12
+ **为什么需要**:统一管理多个账号的归属、权限、合规;支持组织级可信服务(让某服务跨账号操作);支持委托管理员(让成员账号代管组织级能力)。
13
+
14
+ ## 二、里面应该有什么(子结构)
15
+
16
+ | 资源 | 职责 | 必备 |
17
+ |---|---|---|
18
+ | Organization | 组织根容器 | ✅ |
19
+ | Root | 组织根节点(默认) | ✅(自动) |
20
+ | Core OU | 放基础设施账号 | ✅ |
21
+ | Applications OU | 放业务账号 | ✅ |
22
+ | 成员账号 | 各角色账号 | ✅ |
23
+ | Trusted Service | 可信服务(CTS/RMS/IC) | ✅ |
24
+ | Delegated Administrator | 委托管理员(CTS→LogArchive,Config→Security) | ✅ |
25
+
26
+ ## 三、注意点 / 最佳实践 / 坑
27
+
28
+ ### 约束
29
+ - **Organization 是全局服务**,host 不带区域前缀
30
+ - **CreateResourceAccount 异步**:POST 后返回 create_account_status_id,轮询直到 SUCCEEDED(通常几十秒~2分钟)
31
+ - **可信服务要先 enable 才能 delegate**:顺序是 enable trusted service → delegate administrator
32
+
33
+ ### 最佳实践
34
+ - OU 至少分两层:Core(基础设施)+ Applications(业务)
35
+ - 委托管理员职责对齐:LogArchive 管 CTS(它管日志),Security 管 Config(它管安全)
36
+ - 可信服务按需 enable:CTS/RMS/IdentityCenter 是 LZ 基线
37
+
38
+ ### 坑
39
+ - **enable trusted service 幂等**:已 enable 的再 enable 不报错但无效果
40
+ - **delegate administrator 依赖账号 active**:suspended 账号不能做委托管理员
41
+ - **CreateResourceAccount 的账号名全局唯一**:重名会失败
42
+
43
+ ### 组织成员账号规则(CreateResourceAccount)
44
+
45
+ 组织管理账号下创建成员账号使用 **CreateResourceAccount(POST /v2/organizations/accounts)**。
46
+ resource-types.json 的 `account.interface.api` 已配置为 CreateResourceAccount + apiCandidates 选择规则。
47
+
48
+ 创建成员账号(CreateResourceAccount)遵循以下规则,属于组织服务的固有行为,不是可配置项:
49
+ - **只需 `name`**:CreateResourceAccount 的 body 只有 `name`(全局唯一),可选 `description`/`tags`。**不需要 email、不需要手机号**——专为资源账号设计,不携带联系方式;email/手机号是 IAM 用户或 Identity Center 用户的字段,与组织成员账号创建无关,不要向用户索取账号 email。
50
+ - **自动获得 OrganizationAccountAccessAgency**:CreateResourceAccount 时组织云服务会在新账号中自动创建"账号访问委托"(OrganizationAccountAccessAgency)和所需的服务关联委托。这是 assume 跨账号操作成员账号内资源的基础,**无需手动建、无法在 CreateResourceAccount 里配置**。基础设施层(成员账号内 VPC/CFW 等业务资源)依赖此委托做 assume。
51
+ - **异步创建**:POST 后返回 `create_account_status_id`,轮询 ShowCreateAccountStatus 直到 SUCCEEDED(间隔 5s,超时 2min)。**双保险**:主轮询(ShowCreateAccountStatus 精准查单条)失败/超时/无 statusId 时,fallback 到 ListCreateAccountStatuses 按 account_name 从列表匹配(不依赖 statusId,POST 成功即可回查)。
52
+ - **默认挂 root**:CreateResourceAccount 创建的账号默认挂在组织根下,需配合 postAction MoveAccount 移到目标 OU。
53
+
54
+ ## 四、创建依赖
55
+
56
+ ### 前置
57
+ - 无(Organization 是根,无前置)
58
+
59
+ ### 被依赖
60
+ - 账号创建依赖 Organization + OU
61
+ - 可信服务依赖 Organization
62
+ - 委托管理员依赖 Organization + 对应账号 + 可信服务
63
+ - IC 账号分配依赖账号(间接依赖组织)
64
+ - 所有成员账号内资源(VPC/CFW)依赖账号(间接依赖组织)
65
+
66
+ ## 五、怎么查接口(指向 ops-deploy)
67
+
68
+ | 查什么 | productshort | 关键 API |
69
+ |---|---|---|
70
+ | 组织 | Organizations | ShowOrganization / ListRoots |
71
+ | OU | Organizations | ListOrganizationalUnits / CreateOrganizationalUnit |
72
+ | 账号 | Organizations | ListAccounts / CreateResourceAccount |
73
+ | 账号创建状态 | Organizations | ShowCreateAccountStatus |
74
+ | 可信服务 | Organizations | ListTrustedServices / EnableTrustedService |
75
+ | 委托管理员 | Organizations | ListDelegatedAdministrators / RegisterDelegatedAdministrator |
76
+
77
+ **查法**:`apiexplorer('Organizations')` → `apiexplorer('Organizations', apiName, compact=true)` → `endpoints=true`。
78
+ > 全局服务 host,以 endpoints 查到的为准。CreateResourceAccount 异步,需配合 ShowCreateAccountStatus 轮询(间隔 5s,超时 2min,可配置)。
79
+ > CreateResourceAccount 等较新 API 走 OpenAPI 3.0 格式,apiexplorer 能解析(swagger 格式解析属工具层实现,见 ops-deploy / 代码注释,不在 LZ 知识)。
80
+
81
+ ## 六、资源探测指引
82
+
83
+ > ⚠️ 本节定义该资源如何探测是否已存在。
84
+ > 格式契约:JSON 代码块,每个资源类型的探测步骤 + 依赖链 + 匹配字段。
85
+ > 缺什么查什么:步骤依赖的参数缺失时,按 depends 链先查依赖。
86
+
87
+ ```json
88
+ {
89
+ "probes": [
90
+ {
91
+ "typeId": "organization",
92
+ "service": "Organizations",
93
+ "hostMode": "global",
94
+ "steps": [
95
+ { "step": 1, "action": "query-host", "productshort": "Organizations", "via": "apiexplorerHost", "output": "host" },
96
+ { "step": 2, "action": "query-list", "method": "GET", "api": "ShowOrganization", "path": "/v1/organizations", "output": "organization", "save": true }
97
+ ],
98
+ "match": { "field": "organization.id", "expect": "exists-non-empty" },
99
+ "existsStatus": "historical_exists",
100
+ "pendingDetail": "组织未创建,待建"
101
+ },
102
+ {
103
+ "typeId": "ou",
104
+ "service": "Organizations",
105
+ "hostMode": "global",
106
+ "steps": [
107
+ { "step": 1, "action": "query-host", "productshort": "Organizations", "via": "apiexplorerHost", "output": "host" },
108
+ { "step": 2, "action": "query-root", "method": "GET", "api": "ListRoots", "path": "/v1/organizations/roots", "output": "rootId", "extract": "roots[0].id", "save": true, "depends": ["host"] },
109
+ { "step": 3, "action": "query-list", "method": "GET", "api": "ListOrganizationalUnits", "path": "/v1/organizations/organizational-units?parent_id={rootId}", "output": "organizational_units", "save": true, "depends": ["host", "rootId"] }
110
+ ],
111
+ "match": { "field": "organizational_units[].name", "expect": "equals-semanticParam", "semField": "name" },
112
+ "existsStatus": "historical_exists",
113
+ "existsDetail": "OU {name} 已存在,复用",
114
+ "pendingDetail": "OU {name} 未创建,待建"
115
+ },
116
+ {
117
+ "typeId": "account",
118
+ "service": "Organizations",
119
+ "hostMode": "global",
120
+ "steps": [
121
+ { "step": 1, "action": "query-host", "productshort": "Organizations", "via": "apiexplorerHost", "output": "host" },
122
+ { "step": 2, "action": "query-list", "method": "GET", "api": "ListAccounts", "path": "/v1/organizations/accounts", "output": "accounts", "save": true, "depends": ["host"] }
123
+ ],
124
+ "match": { "field": "accounts[].name", "expect": "equals-semanticParam", "semField": "name", "filter": "status != suspended" },
125
+ "existsStatus": "historical_exists",
126
+ "existsDetail": "账号 {name} 已存在,复用",
127
+ "pendingDetail": "账号 {name} 未创建,待建"
128
+ },
129
+ {
130
+ "typeId": "trusted_service",
131
+ "service": "Organizations",
132
+ "hostMode": "global",
133
+ "steps": [
134
+ { "step": 1, "action": "query-host", "productshort": "Organizations", "via": "apiexplorerHost", "output": "host" },
135
+ { "step": 2, "action": "query-list", "method": "GET", "api": "ListTrustedServices", "path": "/v1/organizations/trusted-services", "output": "trusted_services", "save": true, "depends": ["host"] }
136
+ ],
137
+ "match": { "field": "trusted_services[].service_principal", "expect": "equals-semanticParam", "semField": "servicePrincipal" },
138
+ "existsStatus": "historical_exists",
139
+ "existsDetail": "可信服务 {servicePrincipal} 已启用,复用",
140
+ "pendingDetail": "可信服务 {servicePrincipal} 未启用,待建"
141
+ },
142
+ {
143
+ "typeId": "delegated_admin",
144
+ "service": "Organizations",
145
+ "hostMode": "global",
146
+ "steps": [
147
+ { "step": 1, "action": "query-host", "productshort": "Organizations", "via": "apiexplorerHost", "output": "host" },
148
+ { "step": 2, "action": "query-list", "method": "GET", "api": "ListDelegatedAdministrators", "path": "/v1/organizations/delegated-administrators?service_principal={servicePrincipal}", "hostKey": "host", "output": "delegated_administrators", "save": true, "depends": ["host"] }
149
+ ],
150
+ "match": { "field": "delegated_administrators[0].account_id", "expect": "exists-non-empty" },
151
+ "existsStatus": "historical_exists",
152
+ "existsDetail": "委托管理员({servicePrincipal})已存在,复用",
153
+ "pendingDetail": "委托管理员({servicePrincipal})未设置,待建"
154
+ }
155
+ ]
156
+ }
157
+ ```
158
+
159
+ > 字段说明:
160
+ > - `hostMode=global`:全局服务 host 不带区域前缀;`regional`:区域服务 host 带 `<region>.`
161
+ > - `steps`:探测步骤,按顺序执行;`action` 可为 query-host(查 host)/query-root(查根 id)/query-list(查资源列表)
162
+ > - `depends`:本步骤依赖的参数(来自前序步骤的 output);缺失时先查依赖(缺什么查什么)
163
+ > - `path` 里的 `{rootId}` 等占位:运行时用前序步骤的 output 填换
164
+ > - `match.expect=exists-non-empty`:字段非空即存在(如 organization.id)
165
+ > - `match.expect=equals-semanticParam`:列表里找字段值 === 实例 semanticParams 的某字段;`semField` 指定用哪个 semanticParams 字段(默认 name,如 servicePrincipal)
166
+ > - `match.filter`:过滤条件(如 'status != suspended')
167
+ > - `existsStatus`/`existsDetail`/`pendingDetail`:判定结果的状态与文案({name}/{servicePrincipal} 占位用 semanticParams 对应字段填)
168
+
169
+ ## 七、异步创建与终局对账(account)
170
+
171
+ > CreateResourceAccount 是异步接口:POST 只返回任务凭据(create_account_status.id),
172
+ > 云端后台继续执行,**不因客户端放弃轮询而取消**。轮询参数(状态值/失败原因字段)声明在
173
+ > resource-types.json 的 account.asyncPoll;本节是超时后的对账决策表(唯一真相源,
174
+ > orchestrator.ts reconcileAsyncCreation 按此实现)。
175
+
176
+ **核心语义:超时只能证明"未观察到终态",不能证明"创建失败"。** 凭据(statusId)查的是
177
+ 任务进度;账号名是业务事实的主键。超时之后,信事实,不信进度。
178
+
179
+ ### 对账决策表(轮询超时后,按序判定)
180
+
181
+ | 序 | 判定动作 | 命中条件 | 结论 |
182
+ |---|---|---|---|
183
+ | ① | 按名查账号表(ListAccounts,探测声明见本文档六 account probes) | 同名账号存在 | **created**(回填真实账号 id;下游依赖、MoveAccount 归位照常) |
184
+ | ② | 最后查一次任务状态(ShowCreateAccountStatus,归一化比较) | state=succeeded | **created**(回填 account_id) |
185
+ | ③ | 同上 | state=failed | **failed**(带云端 failure_reason,如 error.2001——同名账号已存在的重复创建被云拒绝) |
186
+ | ④ | 以上均无果(仍 in_progress/未知) | — | **pending(未决≠失败)**:任务仍在后台执行;下轮 run 的入口兜底现查(同一探测声明)自动收敛为 exists |
187
+
188
+ ### 历史教训(调测实证,2026-11-11)
189
+
190
+ - **状态值大小写**:APIExplorer 文档示例是大写(SUCCEEDED/FAILED),服务端实测返回小写
191
+ (succeeded/failed)。知识以**实测为准**;引擎比较统一归一化(normState)兜底。
192
+ 实测后果:声明抄文档大写 → 轮询 24 次"查到了却认不出" → 误报 failed → 下轮重复创建。
193
+ - **同名账号可并存**:华为云 Organizations 的账号唯一键是账号 id,不是名字——
194
+ "假失败 → 重跑再建"完全可能产生两个同名账号(本次靠云端 error.2001 拒绝才未成事故)。
195
+ 创建请求发出前必须先按名现查(防重),超时后必须按名对账(认账)。
196
+
197
+ ## 八、演示示例
198
+
199
+ ```
200
+ Organization: o-xxx(管理账号 hwstaff_ldz_test)
201
+ Root: r-xxx
202
+ ├─ Core OU (ou-xxx)
203
+ │ ├─ es_SharedServices (account-xxx, active)
204
+ │ ├─ es_LogArchive (account-xxx, active)
205
+ │ └─ es_SecurityServices (account-xxx, active)
206
+ └─ Applications OU (ou-xxx)
207
+ ├─ es_DailyService (account-xxx, active)
208
+ └─ es_ProdService (account-xxx, active)
209
+
210
+ Trusted Services: service.CTS / service.IdentityCenter / service.RMSMultiAccountSetup
211
+ Delegated Admins: LogArchive(CTS) / Security(Config)
212
+ ```
@@ -0,0 +1,157 @@
1
+ # 推荐配置(已过时 — 代码不消费)
2
+
3
+ > ⚠️ **本文件已过时,代码不消费**。实际推荐配置的唯一真相源是 `knowledge/modules/recommended-rules.json`。
4
+ > planner.ts `getModuleRecommendedConfig` 从 recommended-rules.json 的 `interactions["P1-4_<moduleId>"].recommended` 读取,不读本文件。
5
+ > 本文件保留仅作历史参考,内容可能与 recommended-rules.json 不一致(如 cfwEdition 本文件写 standard,推荐值写 professional)。
6
+ > 改推荐配置 → 改 recommended-rules.json,不要改本文件。
7
+
8
+ ---
9
+
10
+ > 历史内容(仅供参考,不代表当前实际推荐值):
11
+ > standard 方向每个模块的推荐默认参数。custom 方向作为参考提供。
12
+
13
+ ---
14
+
15
+ ## 一、设计原则
16
+
17
+ - 每个模块的推荐参数集中在本文件,按模块组织
18
+ - standard-baseline.md 的 spec 引用本文件组装(或代码同时读两文件,本文件为准)
19
+ - module-layers.md 的 moduleDetail.items.xxx.defaults 引用本文件(不重复写 defaults)
20
+ - 改推荐配置 → 只改本文件
21
+
22
+ ---
23
+
24
+ ## 二、推荐配置(按模块)
25
+
26
+ ### accounts 模块
27
+
28
+ | 参数 | 推荐值 | 说明 |
29
+ |---|---|---|
30
+ | sharedServices.name | es_SharedServices_{env} | 共享服务账号全名({env}=环境标识,如 test5) |
31
+ | logArchive.name | es_LogArchive_{env} | 日志归档账号全名 |
32
+ | security.name | es_SecurityServices_{env} | 安全服务账号全名 |
33
+ | ops.name | es_OpsService_{env} | 运维账号全名 |
34
+ | ops.displayName | 运维账号 | 运维账号显示名 |
35
+ | dev.name | es_DailyService_{env} | 测试账号全名 |
36
+ | dev.displayName | 测试账号 | 测试账号显示名 |
37
+ | prod.name | es_ProdService_{env} | 生产账号全名 |
38
+ | prod.displayName | 生产账号 | 生产账号显示名 |
39
+ | buildDebugAccounts | true | 建 Dev+Prod 调试账号 |
40
+
41
+ > {env} 环境标识:standard 默认 test5,用户可在 moduleDetail 覆盖。账号名需 es_ 前缀(华为云 Organizations 约定)。
42
+
43
+ ### ou_structure 模块
44
+
45
+ | 参数 | 推荐值 | 说明 |
46
+ |---|---|---|
47
+ | ouList | ["Core", "Applications"] | Core OU 放基础设施账号,Applications OU 放业务账号 |
48
+
49
+ ### trusted_services 模块
50
+
51
+ > 推荐值来源:standard-baseline.md 的 spec.trustedServices(唯一来源)
52
+
53
+ | 参数 | 推荐值 | 说明 |
54
+ |---|---|---|
55
+ | services | ["service.CTS", "service.RMSMultiAccountSetup", "service.IdentityCenter"] | CTS 审计 + Config 资源盘点 + IdentityCenter 身份 |
56
+ | delegatedAdmins | [{service:"service.CTS", delegateTo:"logArchiveAccount"}, {service:"service.RMSMultiAccountSetup", delegateTo:"securityAccount"}] | CTS 委托 LogArchive,Config 委托 Security |
57
+
58
+ ### identity_center 模块
59
+
60
+ | 参数 | 推荐值 | 说明 |
61
+ |---|---|---|
62
+ | alias | landingzone-ic | IC 实例别名 |
63
+ | users | [{userName:"lzadmin", displayName:"LZ Admin", email:"", passwordMode:"EMAIL"}] | IC 管理员用户 |
64
+ | groups | [{name:"LZ-Administrators", members:["lzadmin"]}] | 管理员组 |
65
+ | permissionSets | [{name:"LZ-ReadOnly", policies:["Tenant Guest"]}] | 只读权限集 |
66
+
67
+ ### audit_logging 模块
68
+
69
+ | 参数 | 推荐值 | 说明 |
70
+ |---|---|---|
71
+ | configBucketName | config-bucket-{domainId} | Config OBS 桶名(含管理账号 ID 防冲突) |
72
+ | configAgencyName | rms_tracker_trust_agency | Config 信任委托名 |
73
+ | ctsTrailName | system | CTS 追踪器名 |
74
+ | ctsBucketName | obs-cts-{domainId} | CTS OBS 桶名(含账号 ID 防冲突) |
75
+ | ltsProjectName | lz-cts-logarchive | LTS 项目名 |
76
+
77
+ > {domainId} 占位符:运行时用管理账号 domain_id(从 ShowOrganization.management_account_id 取)替换。
78
+
79
+ ### vpc_network 模块
80
+
81
+ | 参数 | 推荐值 | 说明 |
82
+ |---|---|---|
83
+ | vpcCidrs.shared | 10.0.0.0/16 | 共享 VPC 网段 |
84
+ | vpcCidrs.dev | 10.1.0.0/16 | Dev VPC 网段 |
85
+ | vpcCidrs.prod | 10.2.0.0/16 | Prod VPC 网段 |
86
+ | vpcCidrs.ops | 10.3.0.0/16 | Ops VPC 网段 |
87
+ | subnets | (见 standard-baseline.md 默认子网表) | Dev 子网规划:4 个(ER 接入 A/B + 业务 A/B) |
88
+
89
+ ### er_mesh 模块
90
+
91
+ | 参数 | 推荐值 | 说明 |
92
+ |---|---|---|
93
+ | erName | er-enterprise-lz | ER 实例名 |
94
+ | erAsn | 64512 | ER ASN(私有范围) |
95
+
96
+ ### cfw 模块
97
+
98
+ | 参数 | 推荐值 | 说明 |
99
+ |---|---|---|
100
+ | cfwEdition | standard | CFW 版本(standard=标准版 2800元/月,professional=专业版 9800元/月) |
101
+
102
+ ### waf 模块
103
+
104
+ | 参数 | 推荐值 | 说明 |
105
+ |---|---|---|
106
+ | wafEdition | standard | WAF 版本(starter=入门版 99元/月,standard=标准版 3880元/月) |
107
+
108
+ ### scp 模块
109
+
110
+ > 推荐策略来源:**[scp-policies.json](scp-policies.json)**(唯一来源,含完整 content)
111
+ > planner.ts 从 json 读,recommended-config.md 引用(人读视图),不重复 content。
112
+ > availableTargets 从 standard-baseline.md 的 spec.organization 动态生成(root + OU 名)。
113
+ > **规则记录**:SCP 支持 Condition 的 `ForAnyValue:StringNotEquals` 排除特定账号(如 `g:DomainName != 某账号` 可绕过 Deny)。推荐策略默认不含例外(全员生效),用户可在 moduleDetail 自定义 content 添加例外。
114
+
115
+ #### 推荐策略清单(详见 scp-policies.json)
116
+
117
+ | # | name | description | attachTarget | 说明 |
118
+ |---|---|---|---|---|
119
+ | 1 | DenyHighRiskPortsIngress | 禁止安全组对公网(0.0.0.0/0)入方向开放高危端口 | root | 65 个高危端口(22/3389/3306等) |
120
+ | 2 | DenyDeleteLogArchive | 禁止删除/关闭组织内成员账号 | root | 日志归档保护(全组织生效) |
121
+
122
+ > 改策略 content(如改端口列表/Action)→ 改 scp-policies.json,不碰代码/其他文档。
123
+
124
+ #### 绑定目标(用户选,不查 ID)
125
+
126
+ | 选项 | attachTarget 值 | 说明 |
127
+ |---|---|---|
128
+ | 根组织 | root | 全组织生效(推荐) |
129
+ | 自定义 | OU名(如 Core)或账号名(如 es_LogArchive_test5) | 用户填,绑定到特定 OU 或账号 |
130
+ | 不绑定 | 空(不填) | 只创建规则,用户自行绑定 |
131
+
132
+ > moduleDetail/verifying 时不查 ID(资源可能未建)。执行时(run)按 attachTarget 查:root→ListRoots,OU名→ListOrganizationalUnits,账号名→ListAccounts。
133
+ > verifying 检查 attachTarget 对应实体是否在方案资源清单(已建/待建),不在标⚠️提示用户核对。
134
+
135
+ ---
136
+
137
+ ## 三、intake 维度推荐值(custom 方向参考)
138
+
139
+ > moduleDetail 阶段问的维度(非模块参数),standard 直接用推荐值,custom 附参考。
140
+
141
+ | 维度 | 推荐值 | 说明 |
142
+ |---|---|---|
143
+ | complianceLevel | none | 默认无合规要求 |
144
+ | regions | cn-north-4 | 推荐华北-北京四(资源最全) |
145
+ | createDebugAccounts | true | 建调试账号 |
146
+ | budgetCeiling | 0 | 无上限 |
147
+ | identitySource | local | IC 本地用户 |
148
+ | networkTopology | multi-vpc | 多 VPC + ER |
149
+
150
+ ---
151
+
152
+ ## 四、维护提醒
153
+
154
+ - 改推荐配置:只改本文件对应模块段
155
+ - standard-baseline.md 的 spec:保持与本文件一致(代码读 spec,本文件是模块化视图)
156
+ - module-layers.md 的 defaults:引用本文件,不重复定义
157
+ - 加新模块:本文件加一节 + module-layers.md 加模块