* Refactor skill turn harness, fix session serialization, and resolve E2E test failures * Ignore symlinks during workspace copying and enforce sandbox boundaries in playbooks * Refactor interaction loop to use clean async generator-based Event flow * Introduce dedicated async generator test and improve autonomous tester instructions * Enforce strict sandbox awareness and Step 8 policy import gates * Track and display conversation context size next to turn headers * Streamline token usage display to only appear in turn step headers * Refactor token usage tracking to show actual active context size * Implement progress tracking block and human recovery in test harness * docs: document and categorize repository skills and tools * docs: add maintenance instructions for updating FACTORIES.md tables * docs: add missing data-catalog-policy-tag factory in FACTORIES.md * docs: add missing networking stage sub-factories in FACTORIES.md * docs: add systematic commands for discovering module/stage factories in FACTORIES.md * docs: add missing vpcs factories in 0-org-setup and 2-project-factory stages
7.5 KiB
7.5 KiB
Phase 4: Configuration & Wrap-up
Step 7: Configuration Generation
- Explain Datasets: Briefly explain to the user that FAST uses "datasets" (collections of YAML files) that fully describe the design, architecture, resources, and policies applied.
- Select the Dataset: Ask the user to select the dataset they want to use for their landing zone design.
- If GCD: Explicitly state that the
classic-gcddataset must be used for GCD installations. - If Standard GCP: Offer the available datasets and ask them to choose one. Crucially, only search for available datasets within the
fast/stages/0-org-setup/datasets/directory. Do not search across the entire repository or other FAST stages. Provide a one-line description below each dataset when presenting the options (e.g., "classic: The standard FAST landing zone architecture", "hardened: A more restrictive, hardened landing zone architecture").
- If GCD: Explicitly state that the
- Explain Defaults Configuration: Explain to the user that we are starting the configuration of the
defaults.yamlfile, which drives the static configuration of the dataset by providing the Org ID, Billing ID, user-specified locations, and any static values they need to bring in from the outside (like additional IAM principals used in the YAML files to assign IAM roles). - Determine Locations: FAST uses a set of locations for different services.
- If GCD: The region is fixed based on the universe selected in Phase 1. Set the
logginglocation toglobaland all other required locations to the Universe Region. Do not ask the user to choose; simply show them the configured locations. - If Standard GCP: Check the
fast/stages/0-org-setup/schemas/defaults.schema.jsonto identify the required location keys (e.g.,bq,gcs,logging,pubsub). First, ask the user to provide a "base location" (e.g.,europe-west1), explaining that submitting without answering will confirm the default value. Even if the user confirms the base location, you must then ask if they need to override the location for any individual services.
- If GCD: The region is fixed based on the universe selected in Phase 1. Set the
- Determine Local Path: Explain to the user that FAST generates provider configurations and other files that need to be stored outside the repository. This is defined by the
output_files.local_pathsetting. Propose a default path based on the chosen prefix (e.g.,~/fast-config/<prefix>) and ask the user to confirm or provide a different path. Crucially, if the user provides a relative path (e.g.,custom-fast-configor./custom-fast-config), use it exactly as provided relative to the current working directory. Do not automatically prepend~/to their input. Once confirmed, create this directory usingmkdir -p <LOCAL_PATH>. - Ask for Additional Context: Ask the user if there are any other static values they want to bring in from outside to be referenced in the YAML files. Show them the available context keys (excluding
condition_vars). Provide examples showing that prefixes are mandatory for IAM principals (e.g.,user:foo@example.com,group:bar@example.com). For GCD, also show aprincipalSet:example. Do not use shell commands likeechoorcatto show this list; output it directly in your chat message or theask_userprompt. - Create Local Directories and Copy Defaults:
- Create the
data/0-org-setup/andproviders/directories inside the confirmedlocal_path(mkdir -p <LOCAL_PATH>/data/0-org-setup/ <LOCAL_PATH>/providers/). - Copy (do not move) the
defaults.yamlfrom the chosen dataset folder to<LOCAL_PATH>/data/0-org-setup/defaults.yamlusingcp.
- Create the
- Edit the Copied Defaults File: Use the
replacetool to edit the copied<LOCAL_PATH>/data/0-org-setup/defaults.yamlfile.- Populate
global.billing_account,global.organization.id,global.organization.domain, andglobal.organization.customer_id(using the values gathered in Phase 2). Note thatcustomer_idmay not be present for GCD. - Populate
context.iam_principals.gcp-organization-admins(using the Admin Principal determined in Phase 2). - Populate the service-specific locations gathered in the previous step into the
context.locationsblock and map them appropriately inprojects.defaults.locations. - Populate
output_files.local_pathwith the confirmed path. - If additional context was provided, add it to the
contextblock. - If GCD, ensure the
overrides.universeblock is present withdomain,prefix, and specific identity overrides.
- Populate
- Run YAML validation:
yamllint -c .yamllint --no-warnings <LOCAL_PATH>/data/0-org-setup/defaults.yaml. Handle missing tool errors as described in the Core Principles. - Create Configuration Files:
- Use
write_fileto create0-org-setup.auto.tfvarsinside thelocal_path(<LOCAL_PATH>/0-org-setup.auto.tfvars). - In
0-org-setup.auto.tfvars, set thefactories_configvariable. Thedatasetshould point to the original dataset folder (e.g.,"datasets/classic"), but thepaths.defaultsmust point to the absolute path of the copied defaults file. - If GCD, also: Create a temporary
0-org-setup-providers.tffile containing the specificuniverse_domainconfiguration usingwrite_fileat<LOCAL_PATH>/providers/0-org-setup-providers.tf.
- Use
- Present Configuration and Halt: Briefly tell the user you have created and validated the baseline configuration files. You MUST stop execution immediately, present the generated files, ask the user if they are ready to proceed with Step 8 (Organization Policy Import Check), and wait for their response. Do not proceed to Step 8 or run more tools in this turn.
Step 8: Organization Policy Import Check
- Explain that pre-existing organization policies can cause
409 Conflicterrors during the first apply if not imported. - Provide (or execute if automatic) the command to list current policies.
gcloud org-policies list --organization="<ORG_ID>" --format="value(constraint)" - STOP Execution and Wait: You MUST stop execution immediately here, ask the user to run the command, and wait for them to paste the output. Do NOT proceed to Step 9 or update any files until the user has explicitly provided the output of this command.
- Update
0-org-setup.auto.tfvars: If any policies are returned, capture the output, format it as an HCL list in memory, and use thereplacetool to append theorg_policies_importsvariable to the0-org-setup.auto.tfvarsfile. ABSOLUTELY NEVER use shell redirection likeecho >>,awk >>, orcat <<EOF >>to edit files. Explain to the user that this tells Terraform to import these existing policies rather than attempting to recreate them.
Step 9: Wrap-up & Apply
- Link Configuration: Instruct the user to link the final configuration files to the stage directory using the
fast-links.shscript. They should navigate tofast/stages/0-org-setup/and run:Explain that they should then copy and run the commands printed by the script to create the links. Note: If they are not on GCD, they can ignore the provider file linking command printed by the script for the first run.../../fast-links.sh <LOCAL_PATH> - Remind the user that the prerequisite phase is complete.
- Instruct them to run
terraform initandterraform apply. - Remind them to delete the temporary project and reset their gcloud default project to
iac-0after a successful apply. Provide the exact commands for them to copy and use later:gcloud projects delete <TEMP_PROJECT_ID> gcloud config set project <IAC_PROJECT_ID>