Repository navigation
feat(cli): configure and render stages 0 and 1 - #357
Conversation
aghassemlouei
left a comment
There was a problem hiding this comment.
Ran the full cli verification suite including all 842 pytest unit, snapshot, and @pytest.mark.terraform tests against 0-bootstrap and 1-resman, ruff, and pyright, and reviewed the Stage 0 and Stage 1 configuration models, HCL renderer, and preflight checks. Everything passes cleanly.
#355 and #356 are now merged into main, so this branch can be rebased onto main whenever the lab Stage 0 apply completes.
cef19d8 to
860d6f1
Compare
Stage 0 switches between its first and final apply on whether bootstrap_user is set, and the DDG passes it with -var on the first apply only. A plain terraform apply then silently runs the final mode, and a leftover value keeps the bootstrap mode. - Add the stage0_phase answer, bootstrap by default and final after the state migration; --answers-from never carries it. - In the bootstrap phase, render writes 0-bootstrap-phase.auto.tfvars with bootstrap_user, and in the final phase it removes the file. - Require bootstrap_user in the bootstrap phase, refuse to replace a phase file stellar did not write, and warn when the bootstrap phase meets a remote backend. - Print init, plan and apply hints without -var, and document the phase switch in the README.
57c8a06 to
6a69764
Compare
|
Rebased onto Two commits landed after your review, so the suite now has 875 tests:
Could you take a look at the phase file and |
aghassemlouei
left a comment
There was a problem hiding this comment.
Reviewed the stage0_phase phase file lifecycle (0-bootstrap-phase.auto.tfvars), stellar imports scan organization policy import generation, and the updated pre-created workload tests. All 875 CLI tests, ruff, pyright, and the root verification suite pass cleanly. LGTM!
Description
Record the answers of a deployment once and render ready-to-run Terraform workspaces for the
0-bootstrapand1-resmanstages, so operators stop copying samples and editing tfvars by hand.This is the second CLI pull request in the series that issue #306 tracks, after the
stellar preflightcommand in #305. It adds the following to thecli/project.stellar initcommand validates every answer against the repository before it saves theanswers.yamlfile.--setand--non-interactiveflags of thestellar initcommand support scripted runs.--answers-fromand--from-config-envflags seed the answers from another environment or from thescripts/config.envfile.--new-prefixflag suggests a fresh prefix.stellar env list,stellar env use, andstellar env showcommands manage several environments in one home folder.--homeflag and theSTELLAR_HOMEenvironment variable select the home folder, so each deployment can live in its own folder outside the checkout.stellar rendercommand builds each stage workspace from symlinks to the engine checkout and writes the tfvars file from the stage sample.stellar rendercommand never writes a key that a*.auto.tfvars.jsonfile provides.<placeholder>value survives in the rendered tfvars file.stage0_phaseanswer owns the Stage 0 phase, so thestellar rendercommand writes the0-bootstrap-phase.auto.tfvarsfile with thebootstrap_uservariable for the first apply and removes it for the final apply.-var bootstrap_useroption, so a plainterraform applycan no longer run the wrong mode.importsanswer writes Terraform import blocks that adopt the Stage 0 projects and the Assured Workloads workload that an administrator creates in advance.stellar imports scancommand records the existing organization policies, so the final Stage 0 apply imports them in place of theimport.shscript.keep_imported_projectsanswer keeps pre-created projects on destroy through theproject_deletion_policiesvariable that feat(0-bootstrap): support pre-created projects and workloads #355 added to thefast/stages-aw/0-bootstrap/stage.stellar preflightcommand now reads theanswers.yamlfile of the current environment.billing.precreatepreflight check lists the resources that someone with billing access must create in advance.cli/README.mdfile describes the Stage 0 operator flow end to end.cli-testsjob in.github/workflows/ci.ymlinstalls Terraform, so the tests that run the real binary also run in CI.The import and pre-create support stays in this pull request, because a rendered Stage 0 workspace cannot apply in an organization without billing access otherwise.
The CLI writes the answers and the generated files with 0600 permissions, because they hold organization identifiers and principals.
Part of #306. The prefix suggestion of the
--new-prefixflag and the soft-deleted tenant project check address the redeploy problem in #50.A Stage 0 apply in a lab organization succeeds with these workspaces on
main. The lab run found the Stage 0 bugs that #358, #359, and #361 fixed, and #355 and #356 added the support for pre-created resources.Type of Change
Deployment & Compliance Impact
Checklist
Code Quality & Reusability
modules/orfast/stages-aw/can be leveraged for this change.docs/naming-convention.md.Documentation
README.mdof the modified module or blueprint.Security
Testing
Testing Performed
uv run pytestin thecli/project passes 875 tests.cli/tests/directory, because the root suite runs without the CLI dependencies.terraformmarker run the real Terraform binary.terraform fmt.terraform planfor every regime fixture.terraform initandterraform validatein a symlinked Stage 0 workspace with generated import blocks.variables.tffile and the CLI limits with the Terraform validation blocks.ruff format --check,ruff check,pyright, andtools/check_boilerplate.pypass for thecli/project.stellar preflightcommand ran against the lab organization and reported the resources to create in advance.