Files
Triple-C/aws/terraform/user-onboard/variables.tf
T
shadowdaoandClaude Opus 5.5 6911b9de27 fix(aws): final review round for the environment stacks
Critical
- Owner key is sha256("<region>:<aws:userid>") (12 hex): IAM role names are
  account-global and environments regional, so the same user and env name
  in two regions no longer collide. Every caller, the onboarding module's
  owner_key validation, docs and a two-region test.

Important
- A failed onboarding is Incomplete, not Joined: Joined needs the task role
  and, where the bucket is readable, the state's new onboarding_complete
  output (depends_on every resource); a failed or errored local run or a
  stale lock is Incomplete. Join stays as the retry; Follow, Unlock (own
  key only, stale, conditional delete) and Push saved state work on the
  caller's own onboarding.
- errored.tfstate: the runner logs an Error line naming it, follow's
  summary says so, materialize refuses while it exists, and the new
  push_aws_saved_state command runs `tofu state push errored.tfstate`
  through the same runner (file set aside once pushed); UI on the row.
- Bundle README: the bucket is created with the component tag in
  --create-bucket-configuration (the policy's RequestTag condition), plus
  the TLS-only bucket policy; the boundary bundle names an account admin
  WITHOUT the environment-admin files.
- Destroy-incomplete refuses while any users/<env>/ state remains.
- existing network: data.aws_subnet lookups and a precondition (same VPC,
  different AZs) on the task security group.

Minor
- The TLS statement is added to an existing bucket policy, never put over it.
- Deploy progress is emitted to the main window only.
- materialize checks and writes under start.lock.
- UI: managed-elsewhere label and explanation, Incomplete explained,
  Repair/Destroy disabled under a held lock ("Unlock first").
- Cargo.toml libc comment; README: Cancel unavailable on Windows, session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 00:01:32 -08:00

57 lines
2.2 KiB
Terraform

# Every rule here mirrors the app's (`app/src-tauri/src/aws/tofu_modules.rs`),
# so an admin running a bundle by hand gets the same answers as the app.
variable "environment_name" {
description = "The environment to join: lowercase letters, digits and single hyphens, starting with a letter, at most 20 characters."
type = string
validation {
condition = (
can(regex("^[a-z][a-z0-9-]{0,19}$", var.environment_name))
&& !endswith(var.environment_name, "-")
&& !strcontains(var.environment_name, "--")
)
error_message = "environment_name must match ^[a-z][a-z0-9-]{0,19}$, not end in '-' and not contain '--'."
}
}
variable "region" {
description = "The environment's AWS region, e.g. us-west-2."
type = string
validation {
condition = (
can(regex("^[a-z]{2}(-[a-z]+)+-[0-9]+$", var.region))
&& length([for p in ["cn-", "us-gov-", "us-iso-", "us-isob-", "eu-isoe-", "us-isof-"] : p if startswith(var.region, p)]) == 0
)
error_message = "region must be a commercial AWS region id such as us-west-2 (China and GovCloud are not supported)."
}
}
variable "owner_id" {
description = "The user's aws:userid (e.g. AROA...:alice@example.com). Every resource is tagged triple-c:owner with it."
type = string
# Also a tag value, so only characters both allow.
validation {
condition = can(regex("^[A-Za-z0-9_.:/=+@-]{1,128}$", var.owner_id))
error_message = "owner_id must be an aws:userid: 1 to 128 letters, digits and _.:/=+@- characters."
}
}
variable "owner_key" {
description = "The first 12 hex characters of sha256(\"<region>:<owner_id>\"); names the user's roles, which reject the ':' in owner_id. The region is included because role names are account-wide and environments are regional."
type = string
validation {
condition = can(regex("^[0-9a-f]{12}$", var.owner_key)) && var.owner_key == substr(sha256("${var.region}:${var.owner_id}"), 0, 12)
error_message = "owner_key must be the first 12 hex characters of sha256(\"<region>:<owner_id>\")."
}
}
variable "bedrock_on_task_role" {
description = "Whether the task role may invoke Bedrock models (otherwise the workspace user's own credentials are used)."
type = bool
default = false
}