tarmac-cli 0.1.3__tar.gz

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 (73) hide show
  1. tarmac_cli-0.1.3/LICENSE +176 -0
  2. tarmac_cli-0.1.3/PKG-INFO +204 -0
  3. tarmac_cli-0.1.3/README.md +169 -0
  4. tarmac_cli-0.1.3/pyproject.toml +111 -0
  5. tarmac_cli-0.1.3/setup.cfg +4 -0
  6. tarmac_cli-0.1.3/src/tarmac/__init__.py +8 -0
  7. tarmac_cli-0.1.3/src/tarmac/cli/__init__.py +1 -0
  8. tarmac_cli-0.1.3/src/tarmac/cli/account.py +541 -0
  9. tarmac_cli-0.1.3/src/tarmac/cli/baseline.py +448 -0
  10. tarmac_cli-0.1.3/src/tarmac/cli/common.py +77 -0
  11. tarmac_cli-0.1.3/src/tarmac/cli/deploy.py +456 -0
  12. tarmac_cli-0.1.3/src/tarmac/cli/deploy_dry_run.py +677 -0
  13. tarmac_cli-0.1.3/src/tarmac/cli/deploy_phases.py +626 -0
  14. tarmac_cli-0.1.3/src/tarmac/cli/identity.py +80 -0
  15. tarmac_cli-0.1.3/src/tarmac/cli/main.py +589 -0
  16. tarmac_cli-0.1.3/src/tarmac/cli/org.py +294 -0
  17. tarmac_cli-0.1.3/src/tarmac/cli/ou.py +71 -0
  18. tarmac_cli-0.1.3/src/tarmac/cli/preflight.py +194 -0
  19. tarmac_cli-0.1.3/src/tarmac/cli/ui.py +54 -0
  20. tarmac_cli-0.1.3/src/tarmac/core/__init__.py +71 -0
  21. tarmac_cli-0.1.3/src/tarmac/core/aws_client.py +114 -0
  22. tarmac_cli-0.1.3/src/tarmac/core/config_loader.py +377 -0
  23. tarmac_cli-0.1.3/src/tarmac/core/config_schema.py +387 -0
  24. tarmac_cli-0.1.3/src/tarmac/core/exceptions.py +43 -0
  25. tarmac_cli-0.1.3/src/tarmac/core/logging.py +42 -0
  26. tarmac_cli-0.1.3/src/tarmac/core/models.py +191 -0
  27. tarmac_cli-0.1.3/src/tarmac/core/tagging.py +127 -0
  28. tarmac_cli-0.1.3/src/tarmac/core/templates.py +109 -0
  29. tarmac_cli-0.1.3/src/tarmac/py.typed +1 -0
  30. tarmac_cli-0.1.3/src/tarmac/services/__init__.py +35 -0
  31. tarmac_cli-0.1.3/src/tarmac/services/accounts.py +619 -0
  32. tarmac_cli-0.1.3/src/tarmac/services/baseline.py +515 -0
  33. tarmac_cli-0.1.3/src/tarmac/services/cloudformation.py +334 -0
  34. tarmac_cli-0.1.3/src/tarmac/services/drift.py +493 -0
  35. tarmac_cli-0.1.3/src/tarmac/services/identity.py +728 -0
  36. tarmac_cli-0.1.3/src/tarmac/services/organization.py +318 -0
  37. tarmac_cli-0.1.3/src/tarmac/services/ou.py +115 -0
  38. tarmac_cli-0.1.3/src/tarmac/services/preflight.py +583 -0
  39. tarmac_cli-0.1.3/src/tarmac/services/scaffold.py +234 -0
  40. tarmac_cli-0.1.3/src/tarmac/services/scp.py +440 -0
  41. tarmac_cli-0.1.3/src/tarmac/services/security.py +270 -0
  42. tarmac_cli-0.1.3/src/tarmac/services/status.py +102 -0
  43. tarmac_cli-0.1.3/src/tarmac/services/teardown.py +1317 -0
  44. tarmac_cli-0.1.3/src/tarmac/templates/__init__.py +1 -0
  45. tarmac_cli-0.1.3/src/tarmac/templates/cloudformation/account-budget.yaml +114 -0
  46. tarmac_cli-0.1.3/src/tarmac/templates/cloudformation/audit-account-hardening.yaml +310 -0
  47. tarmac_cli-0.1.3/src/tarmac/templates/cloudformation/log-archive-hardening.yaml +287 -0
  48. tarmac_cli-0.1.3/src/tarmac/templates/cloudformation/organization-cloudtrail.yaml +112 -0
  49. tarmac_cli-0.1.3/src/tarmac/templates/cloudformation/terraform-backend.yaml +141 -0
  50. tarmac_cli-0.1.3/src/tarmac/templates/policies/scp/deny-leave-organization.json +13 -0
  51. tarmac_cli-0.1.3/src/tarmac/templates/policies/scp/deny-member-root.json +19 -0
  52. tarmac_cli-0.1.3/src/tarmac/templates/policies/scp/foundational-guardrails.json +27 -0
  53. tarmac_cli-0.1.3/src/tarmac_cli.egg-info/PKG-INFO +204 -0
  54. tarmac_cli-0.1.3/src/tarmac_cli.egg-info/SOURCES.txt +71 -0
  55. tarmac_cli-0.1.3/src/tarmac_cli.egg-info/dependency_links.txt +1 -0
  56. tarmac_cli-0.1.3/src/tarmac_cli.egg-info/entry_points.txt +3 -0
  57. tarmac_cli-0.1.3/src/tarmac_cli.egg-info/requires.txt +6 -0
  58. tarmac_cli-0.1.3/src/tarmac_cli.egg-info/top_level.txt +1 -0
  59. tarmac_cli-0.1.3/tests/test_account_factory.py +636 -0
  60. tarmac_cli-0.1.3/tests/test_aws_client.py +138 -0
  61. tarmac_cli-0.1.3/tests/test_baseliner.py +452 -0
  62. tarmac_cli-0.1.3/tests/test_cli.py +994 -0
  63. tarmac_cli-0.1.3/tests/test_config_schema.py +373 -0
  64. tarmac_cli-0.1.3/tests/test_logging.py +34 -0
  65. tarmac_cli-0.1.3/tests/test_models.py +136 -0
  66. tarmac_cli-0.1.3/tests/test_ou_engine.py +210 -0
  67. tarmac_cli-0.1.3/tests/test_preflight.py +440 -0
  68. tarmac_cli-0.1.3/tests/test_scp.py +607 -0
  69. tarmac_cli-0.1.3/tests/test_security_services.py +242 -0
  70. tarmac_cli-0.1.3/tests/test_services.py +1259 -0
  71. tarmac_cli-0.1.3/tests/test_tagging.py +271 -0
  72. tarmac_cli-0.1.3/tests/test_teardown.py +702 -0
  73. tarmac_cli-0.1.3/tests/test_templates.py +267 -0
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,204 @@
1
+ Metadata-Version: 2.4
2
+ Name: tarmac-cli
3
+ Version: 0.1.3
4
+ Summary: Enterprise AWS Governance & Multi-Account Landing Zone CLI
5
+ Author-email: Nicholas Christian <nicholasdchristian@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/nickdchristian/tarmac-cli
8
+ Project-URL: Documentation, https://github.com/nickdchristian/tarmac-cli#readme
9
+ Project-URL: Repository, https://github.com/nickdchristian/tarmac-cli.git
10
+ Project-URL: Issues, https://github.com/nickdchristian/tarmac-cli/issues
11
+ Keywords: aws,aws-organizations,landing-zone,governance,cloudformation,iam-identity-center,finops,security
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Classifier: Topic :: Security
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: boto3>=1.35.0
29
+ Requires-Dist: botocore>=1.35.0
30
+ Requires-Dist: typer>=0.16.0
31
+ Requires-Dist: rich>=13.8.0
32
+ Requires-Dist: pydantic[email]>=2.8.0
33
+ Requires-Dist: pyyaml>=6.0.2
34
+ Dynamic: license-file
35
+
36
+ # Tarmac CLI (`tarmac-cli`)
37
+
38
+ [![PyPI version](https://img.shields.io/pypi/v/tarmac-cli.svg)](https://pypi.org/project/tarmac-cli/)
39
+ [![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue.svg)](https://www.python.org/)
40
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE)
41
+ [![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
42
+
43
+ **Tarmac** is a declarative, idempotent Python CLI for bootstrapping and governing enterprise multi-account AWS Organizations.
44
+
45
+ Define your organizational units, account factory, SCP guardrails, baseline security (CloudTrail, GuardDuty, Security Hub), and IAM Identity Center (SSO) in simple YAML manifests—then reconcile your entire AWS estate with a single command.
46
+
47
+ ---
48
+
49
+ ## Quickstart
50
+
51
+ ### 1. Installation & Setup
52
+
53
+ Install from source with **[uv](https://docs.astral.sh/uv/)**:
54
+
55
+ ```bash
56
+ git clone https://github.com/nickdchristian/tarmac-cli.git
57
+ cd tarmac-cli
58
+ uv sync
59
+ ```
60
+
61
+ You can then run commands with `uv run tarmac` or install it into your local environment:
62
+ ```bash
63
+ uv pip install -e .
64
+ tarmac --help
65
+ ```
66
+
67
+ *(Once published to PyPI, you can install globally with `uv tool install tarmac-cli`)*
68
+
69
+ ### 2. Initialize Configuration
70
+
71
+ Scaffold a production-ready starter project with baseline YAML manifests and CloudFormation templates:
72
+
73
+ ```bash
74
+ tarmac init --with-templates
75
+ ```
76
+
77
+ This generates:
78
+ * **`config/organization.yaml`**: Organization settings, alternate contacts, OU hierarchy, and SCP guardrails.
79
+ * **`config/accounts.yaml`**: Account Factory catalog, OU placement, monthly budgets, and security baselines.
80
+ * **`config/identity.yaml`**: IAM Identity Center permission sets, users, groups, and multi-account assignments.
81
+
82
+ ### 3. Validate & Inspect Readiness
83
+
84
+ Verify your configurations and audit your AWS Management Account before deploying:
85
+
86
+ ```bash
87
+ # Validate YAML syntax, Pydantic schemas, and cross-references
88
+ tarmac validate
89
+
90
+ # Run 17 automated pre-flight readiness checks (MFA, quotas, contacts, hygiene)
91
+ tarmac preflight
92
+ ```
93
+
94
+ ### 4. Deploy Your Landing Zone
95
+
96
+ Preview proposed actions with a dry run, then execute the automated rollout:
97
+
98
+ ```bash
99
+ # Preview what will be created and configured
100
+ tarmac deploy run --dry-run
101
+
102
+ # Execute the full 6-phase deployment pipeline
103
+ tarmac deploy run
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Deployment Pipeline
109
+
110
+ Tarmac executes an idempotent multi-phase deployment:
111
+
112
+ ```
113
+ [Phase 0: Preflight] ──► Validate AWS prerequisites, quotas, & credentials
114
+ [Phase 1: Org & Root] ──► Bootstrap AWS Organizations, contacts, & root access
115
+ [Phase 2: OUs & SCPs] ──► Idempotently sync OU tree & attach guardrail SCPs
116
+ [Phase 3: Central Log] ──► Deploy Log-Archive bucket & Org-wide CloudTrail
117
+ [Phase 4: Accounts] ──► Provision member accounts, purge default VPCs, set budgets
118
+ [Phase 5: Hardening] ──► Delegate Security Hub / GuardDuty & anomaly monitors
119
+ [Phase 6: Identity] ──► Sync IAM Identity Center permission sets & assignments
120
+ ```
121
+
122
+ You can target a specific phase at any time:
123
+ ```bash
124
+ tarmac deploy run --phase 4 # Run only Account Factory provisioning
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Command Reference
130
+
131
+ | Command | Description |
132
+ | :--- | :--- |
133
+ | **`tarmac init`** | Scaffold starter configuration manifests and CloudFormation templates. |
134
+ | **`tarmac validate`** | Validate configuration manifests against Pydantic schemas and cross-references. |
135
+ | **`tarmac preflight`** | Run 17 diagnostic checks for management account operational readiness (`doctor` alias). |
136
+ | **`tarmac info`** | Display caller identity, AWS account details, and Organization status. |
137
+ | **`tarmac deploy run`** | Execute the automated multi-phase landing zone rollout (`--dry-run` to preview). |
138
+ | **`tarmac status`** | Inspect live landing zone reconciliation and phase completion status. |
139
+ | **`tarmac drift`** | Audit IAM Identity Center permission sets and member account budget drift. |
140
+ | **`tarmac deploy destroy`** | Safely destroy deployed governance stacks (protected by production safety locks). |
141
+
142
+ <details>
143
+ <summary><strong>Granular Service Commands</strong></summary>
144
+
145
+ For targeted management outside the end-to-end pipeline:
146
+
147
+ * **Organizations & OUs**:
148
+ * `tarmac org bootstrap` — Enable AWS Organizations and trusted services.
149
+ * `tarmac org contacts` — Synchronize alternate contacts (Billing, Security, Ops).
150
+ * `tarmac ou sync` — Idempotently synchronize OU tree hierarchy.
151
+ * `tarmac org scp apply` — Reconcile and attach Service Control Policies.
152
+ * **Account Factory**:
153
+ * `tarmac account plan` — Preview proposed account actions (Create, Move, No-op).
154
+ * `tarmac account apply` — Provision missing accounts and assign to OUs.
155
+ * `tarmac account sync-tags` — Synchronize governance tags with member accounts.
156
+ * **Security & Baseline**:
157
+ * `tarmac baseline cloudtrail` — Deploy organization-wide CloudTrail.
158
+ * `tarmac baseline backend` — Deploy Terraform S3 state and DynamoDB locks.
159
+ * `tarmac baseline security` — Deploy GuardDuty, Security Hub, and log hardening.
160
+ * **IAM Identity Center**:
161
+ * `tarmac identity status` — View Identity Center instance status and region.
162
+ * `tarmac identity sync` — Synchronize permission sets, users, groups, and assignments.
163
+
164
+ </details>
165
+
166
+ ---
167
+
168
+ ## Safe Teardown
169
+
170
+ Tarmac includes built-in safeguards to prevent accidental infrastructure or state loss:
171
+ * **Production Environment Lock**: Refuses to destroy any environment tagged with `production` or `prod` unless `--force` is explicitly provided.
172
+ * **Remote State Preservation**: Pass `--preserve-backend` to destroy infrastructure while protecting remote Terraform state buckets and lock tables.
173
+ * **Non-Empty Bucket Protection**: Halts if unmanaged data exists in S3 buckets unless explicitly confirmed.
174
+
175
+ ```bash
176
+ # Preview teardown actions
177
+ tarmac deploy destroy --dry-run
178
+
179
+ # Execute teardown preserving Terraform state
180
+ tarmac deploy destroy --preserve-backend
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Development & Testing
186
+
187
+ ```bash
188
+ # Sync environment dependencies
189
+ uv sync
190
+
191
+ # Run the 247-test Pytest suite
192
+ uv run pytest
193
+
194
+ # Run static analysis and formatting
195
+ uv run ruff check .
196
+ uv run ruff format --check .
197
+ uv run basedpyright
198
+ ```
199
+
200
+ ---
201
+
202
+ ## License
203
+
204
+ Licensed under the [Apache License, Version 2.0](LICENSE).
@@ -0,0 +1,169 @@
1
+ # Tarmac CLI (`tarmac-cli`)
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/tarmac-cli.svg)](https://pypi.org/project/tarmac-cli/)
4
+ [![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue.svg)](https://www.python.org/)
5
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE)
6
+ [![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
7
+
8
+ **Tarmac** is a declarative, idempotent Python CLI for bootstrapping and governing enterprise multi-account AWS Organizations.
9
+
10
+ Define your organizational units, account factory, SCP guardrails, baseline security (CloudTrail, GuardDuty, Security Hub), and IAM Identity Center (SSO) in simple YAML manifests—then reconcile your entire AWS estate with a single command.
11
+
12
+ ---
13
+
14
+ ## Quickstart
15
+
16
+ ### 1. Installation & Setup
17
+
18
+ Install from source with **[uv](https://docs.astral.sh/uv/)**:
19
+
20
+ ```bash
21
+ git clone https://github.com/nickdchristian/tarmac-cli.git
22
+ cd tarmac-cli
23
+ uv sync
24
+ ```
25
+
26
+ You can then run commands with `uv run tarmac` or install it into your local environment:
27
+ ```bash
28
+ uv pip install -e .
29
+ tarmac --help
30
+ ```
31
+
32
+ *(Once published to PyPI, you can install globally with `uv tool install tarmac-cli`)*
33
+
34
+ ### 2. Initialize Configuration
35
+
36
+ Scaffold a production-ready starter project with baseline YAML manifests and CloudFormation templates:
37
+
38
+ ```bash
39
+ tarmac init --with-templates
40
+ ```
41
+
42
+ This generates:
43
+ * **`config/organization.yaml`**: Organization settings, alternate contacts, OU hierarchy, and SCP guardrails.
44
+ * **`config/accounts.yaml`**: Account Factory catalog, OU placement, monthly budgets, and security baselines.
45
+ * **`config/identity.yaml`**: IAM Identity Center permission sets, users, groups, and multi-account assignments.
46
+
47
+ ### 3. Validate & Inspect Readiness
48
+
49
+ Verify your configurations and audit your AWS Management Account before deploying:
50
+
51
+ ```bash
52
+ # Validate YAML syntax, Pydantic schemas, and cross-references
53
+ tarmac validate
54
+
55
+ # Run 17 automated pre-flight readiness checks (MFA, quotas, contacts, hygiene)
56
+ tarmac preflight
57
+ ```
58
+
59
+ ### 4. Deploy Your Landing Zone
60
+
61
+ Preview proposed actions with a dry run, then execute the automated rollout:
62
+
63
+ ```bash
64
+ # Preview what will be created and configured
65
+ tarmac deploy run --dry-run
66
+
67
+ # Execute the full 6-phase deployment pipeline
68
+ tarmac deploy run
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Deployment Pipeline
74
+
75
+ Tarmac executes an idempotent multi-phase deployment:
76
+
77
+ ```
78
+ [Phase 0: Preflight] ──► Validate AWS prerequisites, quotas, & credentials
79
+ [Phase 1: Org & Root] ──► Bootstrap AWS Organizations, contacts, & root access
80
+ [Phase 2: OUs & SCPs] ──► Idempotently sync OU tree & attach guardrail SCPs
81
+ [Phase 3: Central Log] ──► Deploy Log-Archive bucket & Org-wide CloudTrail
82
+ [Phase 4: Accounts] ──► Provision member accounts, purge default VPCs, set budgets
83
+ [Phase 5: Hardening] ──► Delegate Security Hub / GuardDuty & anomaly monitors
84
+ [Phase 6: Identity] ──► Sync IAM Identity Center permission sets & assignments
85
+ ```
86
+
87
+ You can target a specific phase at any time:
88
+ ```bash
89
+ tarmac deploy run --phase 4 # Run only Account Factory provisioning
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Command Reference
95
+
96
+ | Command | Description |
97
+ | :--- | :--- |
98
+ | **`tarmac init`** | Scaffold starter configuration manifests and CloudFormation templates. |
99
+ | **`tarmac validate`** | Validate configuration manifests against Pydantic schemas and cross-references. |
100
+ | **`tarmac preflight`** | Run 17 diagnostic checks for management account operational readiness (`doctor` alias). |
101
+ | **`tarmac info`** | Display caller identity, AWS account details, and Organization status. |
102
+ | **`tarmac deploy run`** | Execute the automated multi-phase landing zone rollout (`--dry-run` to preview). |
103
+ | **`tarmac status`** | Inspect live landing zone reconciliation and phase completion status. |
104
+ | **`tarmac drift`** | Audit IAM Identity Center permission sets and member account budget drift. |
105
+ | **`tarmac deploy destroy`** | Safely destroy deployed governance stacks (protected by production safety locks). |
106
+
107
+ <details>
108
+ <summary><strong>Granular Service Commands</strong></summary>
109
+
110
+ For targeted management outside the end-to-end pipeline:
111
+
112
+ * **Organizations & OUs**:
113
+ * `tarmac org bootstrap` — Enable AWS Organizations and trusted services.
114
+ * `tarmac org contacts` — Synchronize alternate contacts (Billing, Security, Ops).
115
+ * `tarmac ou sync` — Idempotently synchronize OU tree hierarchy.
116
+ * `tarmac org scp apply` — Reconcile and attach Service Control Policies.
117
+ * **Account Factory**:
118
+ * `tarmac account plan` — Preview proposed account actions (Create, Move, No-op).
119
+ * `tarmac account apply` — Provision missing accounts and assign to OUs.
120
+ * `tarmac account sync-tags` — Synchronize governance tags with member accounts.
121
+ * **Security & Baseline**:
122
+ * `tarmac baseline cloudtrail` — Deploy organization-wide CloudTrail.
123
+ * `tarmac baseline backend` — Deploy Terraform S3 state and DynamoDB locks.
124
+ * `tarmac baseline security` — Deploy GuardDuty, Security Hub, and log hardening.
125
+ * **IAM Identity Center**:
126
+ * `tarmac identity status` — View Identity Center instance status and region.
127
+ * `tarmac identity sync` — Synchronize permission sets, users, groups, and assignments.
128
+
129
+ </details>
130
+
131
+ ---
132
+
133
+ ## Safe Teardown
134
+
135
+ Tarmac includes built-in safeguards to prevent accidental infrastructure or state loss:
136
+ * **Production Environment Lock**: Refuses to destroy any environment tagged with `production` or `prod` unless `--force` is explicitly provided.
137
+ * **Remote State Preservation**: Pass `--preserve-backend` to destroy infrastructure while protecting remote Terraform state buckets and lock tables.
138
+ * **Non-Empty Bucket Protection**: Halts if unmanaged data exists in S3 buckets unless explicitly confirmed.
139
+
140
+ ```bash
141
+ # Preview teardown actions
142
+ tarmac deploy destroy --dry-run
143
+
144
+ # Execute teardown preserving Terraform state
145
+ tarmac deploy destroy --preserve-backend
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Development & Testing
151
+
152
+ ```bash
153
+ # Sync environment dependencies
154
+ uv sync
155
+
156
+ # Run the 247-test Pytest suite
157
+ uv run pytest
158
+
159
+ # Run static analysis and formatting
160
+ uv run ruff check .
161
+ uv run ruff format --check .
162
+ uv run basedpyright
163
+ ```
164
+
165
+ ---
166
+
167
+ ## License
168
+
169
+ Licensed under the [Apache License, Version 2.0](LICENSE).
@@ -0,0 +1,111 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tarmac-cli"
7
+ version = "0.1.3"
8
+ description = "Enterprise AWS Governance & Multi-Account Landing Zone CLI"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ authors = [
12
+ { name = "Nicholas Christian", email = "nicholasdchristian@gmail.com" }
13
+ ]
14
+ license = "Apache-2.0"
15
+ license-files = ["LICENSE"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: System Administrators",
20
+ "Intended Audience :: Information Technology",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
27
+ "Topic :: System :: Systems Administration",
28
+ "Topic :: Security",
29
+ "Typing :: Typed",
30
+ ]
31
+ keywords = [
32
+ "aws",
33
+ "aws-organizations",
34
+ "landing-zone",
35
+ "governance",
36
+ "cloudformation",
37
+ "iam-identity-center",
38
+ "finops",
39
+ "security",
40
+ ]
41
+ dependencies = [
42
+ "boto3>=1.35.0",
43
+ "botocore>=1.35.0",
44
+ "typer>=0.16.0",
45
+ "rich>=13.8.0",
46
+ "pydantic[email]>=2.8.0",
47
+ "pyyaml>=6.0.2",
48
+ ]
49
+
50
+ [project.urls]
51
+ Homepage = "https://github.com/nickdchristian/tarmac-cli"
52
+ Documentation = "https://github.com/nickdchristian/tarmac-cli#readme"
53
+ Repository = "https://github.com/nickdchristian/tarmac-cli.git"
54
+ Issues = "https://github.com/nickdchristian/tarmac-cli/issues"
55
+
56
+ [project.scripts]
57
+ tarmac = "tarmac.cli.main:app"
58
+ aws-gov = "tarmac.cli.main:app"
59
+
60
+ [dependency-groups]
61
+ dev = [
62
+ "pytest>=8.3.0",
63
+ "ruff>=0.8.0",
64
+ "cfn-lint>=1.20.0",
65
+ "basedpyright>=1.40.2",
66
+ "radon>=6.0.1",
67
+ "twine>=6.0.0",
68
+ ]
69
+
70
+ [tool.uv]
71
+ managed = true
72
+ default-groups = ["dev"]
73
+
74
+ [tool.setuptools.packages.find]
75
+ where = ["src"]
76
+
77
+ [tool.setuptools.package-data]
78
+ "tarmac" = ["py.typed", "templates/**/*"]
79
+
80
+ [tool.setuptools.exclude-package-data]
81
+ "*" = ["*__pycache__*", "*.pyc"]
82
+
83
+ [tool.pytest.ini_options]
84
+ testpaths = ["tests"]
85
+ pythonpath = ["src"]
86
+ addopts = "-v --strict-markers"
87
+
88
+ [tool.ruff]
89
+ line-length = 110
90
+ target-version = "py311"
91
+
92
+ [tool.ruff.lint]
93
+ select = [
94
+ "E", # pycodestyle errors
95
+ "W", # pycodestyle warnings
96
+ "F", # pyflakes
97
+ "I", # isort
98
+ "B", # flake8-bugbear
99
+ "UP", # pyupgrade
100
+ ]
101
+ ignore = [
102
+ "E501", # line length handled by formatter
103
+ "B008", # do not perform function calls in argument defaults (standard for typer Option/Argument)
104
+ "B904", # raise typer.Exit within except blocks
105
+ ]
106
+
107
+ [tool.basedpyright]
108
+ include = ["src", "tests"]
109
+ exclude = ["**/__pycache__", ".venv"]
110
+ pythonVersion = "3.11"
111
+ typeCheckingMode = "standard"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ """AWS Governance CLI and Multi-Account Landing Zone Automation."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("tarmac-cli")
7
+ except PackageNotFoundError:
8
+ __version__ = "0.1.2"
@@ -0,0 +1 @@
1
+ """CLI package for AWS Governance."""