carlos / platform Public

region-host: fixed host ignores user_data edits (no stop/start)

aws_instance.host lifecycle ignore_changes = [ami, user_data]. user_data
runs only at first boot and user_data_replace_on_change is false, so an
in-place update on a live box only stops and starts it. A host-init edit
in the flagship root (carloku-infrastructure #32/#33) put a stop/start
of all four flagship boxes into every targeted plan touching the hosts,
blocking the status-alarm rollout from 3dd38c04. That relay drop-in
stays unapplied on the four live boxes, as it already is. New boxes
still boot with the current script; rebuild a live one with -replace.

Test: tests/user_data_ignored.tftest.hcl. Census ruling
census-ruling-fixed-host-ignore-user-data (Astra, #280). Astra READY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from fixed-host-ignore-user-data into main.
claude agent, operated by paul@keymail.dev fd6d39ec471637ddb460ea7b05bb971d95c476a5 parent 3dd38c0
5 files changed, +131 −1
  • docs/superpowers/notes/census-proposal-fixed-host-ignore-user-data.md +23 −0
  • infra/modules/region-host/main.tf +9 −1
  • infra/modules/region-host/tests/user_data_ignored.tftest.hcl +89 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-fixed-host-ignore-user-data.tsv +9 −0

CI failed — run details

diff --git a/docs/superpowers/notes/census-proposal-fixed-host-ignore-user-data.md b/docs/superpowers/notes/census-proposal-fixed-host-ignore-user-data.md
new file mode 100644
index 000000000..fbfeb0546
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-fixed-host-ignore-user-data.md
@@ -0,0 +1,23 @@
+# Census approval: fixed-host-ignore-user-data
+
+Ruling `census-ruling-fixed-host-ignore-user-data`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `infra/modules/region-host/main.tf` `external` | body | unchanged (1) | aws_instance.host lifecycle ignore_changes gains user_data (was [ami]): a user_data edit no longer plans an in-place update (stop/start) of a live fixed host; a new box still boots with the given script. tofu only, run on an operator machine; no read is added and nothing on a box reads the file. |
+
+Envelopes re-pinned: `infra/modules/region-host`, `infra/modules/region-host/tests`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `infra/modules/region-host/main.tf` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's module with one optional aws_iam_role_policy, host_console_mail, count 0 unless console_mail_from is set; it grants the host role ses:SendEmail on the one sending identity, the carlos-bab configuration set and its tenants, conditioned on ses:FromAddress equal to console_mail_from; no read is added and nothing on a box reads the file;rev3=census-ruling-sec-host-imdsv2-module;basis=aws_instance.host gains metadata_options (IMDSv2 required, hop limit 1, endpoint enabled), matching scanner-host; tofu configuration only, run on an operator's machine; no read, file or record write is added; applies in place on a running instance with no restart;rev3=census-ruling-hunt-account-root-hardening;basis=adds aws_iam_role_policy host_release_key_deny (count from deny_release_key_reads, default true): an explicit Deny on ssm:GetParameter, GetParameters and GetParameterHistory for parameter/carlos/release-key, and on GetParametersByPath for its ancestor paths; tofu only, run on an operator's machine; no read is added and nothing on a box reads the file;rev3=census-ruling-region-host-store-deny;basis=host_store policy: the explicit Deny on the deployment's own buckets drops s3:DeleteObject and keeps s3:DeleteBucket and s3:CreateBucket (lease release, retention and prune are DeleteObject); tofu only, run on an operator machine; no read is added and nothing on a box reads the file;rev3=census-ruling-region-ha-p3b;basis=Select default fixed resources through counted addresses and explicit moves; group mode selects scoped bucket/SSM policy, partition-aware ARNs and refuses fixed-only settings. Operator Terraform controls the instance role that can read boot parameters and write runtime bucket objects; release-key Deny and fixed-mode policy remain.;rev3=census-ruling-region-ha-g3-fixes;basis=Enable the fixed-host memory alarm with either alert input and use the selected topic for alarm and recovery notifications. Preserve module topic/subscription creation for alerts_email only. No new root runtime read or box authority.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: aws_iam_policy.store_user_boundary is now counted when store_bucket_prefix is set or managed_fleets_enabled is true; its statements are concat of the unchanged object-storage pair (only with a store prefix, moved into local.store_boundary_statements byte for byte) and local.managed_boundary_statements (only with managed fleets: the fleet-data Allows on <managed_fleet_bucket_prefix>* buckets); name unchanged, description conditional on store prefix with lifecycle ignore_changes on description so a later feature switch never replaces the policy; tofu only, run on an operator's machine with the operator's AWS credentials; no box unit, user_data or binary reads the file; no read is added; default (both features off) plans no change;rev3=census-ruling-fixedbox-health-alarms;basis=Fixed host EC2 status-check alarms: auto-recover gains SNS alarm/ok actions (ec2:recover kept); new host_instance_check alarm (StatusCheckFailed_Instance 3 of 3 x 60 s -> ec2:reboot + SNS). tofu only, run on an operator machine; no read is added and nothing on a box reads the file.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `infra/modules/region-host/tests/user_data_ignored.tftest.hcl:external`: reads +file:external; written legacy, accepted-legacy, frozen
+
+Seal: `0f7153571df8c1b4b50c31f57efcfdf60c71a12c80fd935fb3ea202fa0201dd5` → `250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-fixed-host-ignore-user-data.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/infra/modules/region-host/main.tf b/infra/modules/region-host/main.tf
index dd749ba85..d59db290c 100644
--- a/infra/modules/region-host/main.tf
+++ b/infra/modules/region-host/main.tf
@@ -593,8 +593,16 @@ resource "aws_instance" "host" {
# plan in tito's deployment wanted to destroy the production box.
# AMI updates are explicit-replace territory:
# `tofu apply -replace=module.<host>.aws_instance.host` when intended.
+ #
+ # user_data likewise: it runs only at first boot, and with
+ # user_data_replace_on_change = false an edit to it on a live box only
+ # buys a stop/start (downtime) while changing nothing the box does. Seen
+ # 2026-11-09: a host-init edit in the flagship root made every targeted
+ # plan that touched the hosts stop and start all four boxes. A new box
+ # still boots with the current script; to rebuild a live box from it,
+ # replace the box explicitly as above.
lifecycle {
- ignore_changes = [ami]
+ ignore_changes = [ami, user_data]
}
}
diff --git a/infra/modules/region-host/tests/user_data_ignored.tftest.hcl b/infra/modules/region-host/tests/user_data_ignored.tftest.hcl
new file mode 100644
index 000000000..20079a08c
--- /dev/null
+++ b/infra/modules/region-host/tests/user_data_ignored.tftest.hcl
@@ -0,0 +1,89 @@
+# A user_data edit must not plan a change to a live fixed host: user_data
+# runs only at first boot, and an in-place update is a stop/start.
+# mock_provider: no AWS account. The first run applies against the mock to
+# give the second run a prior state to plan from.
+mock_provider "aws" {
+ mock_data "aws_region" { defaults = { region = "eu-west-1" } }
+}
+
+override_data {
+ target = data.aws_vpcs.default
+ values = { ids = ["vpc-0aaaaaaaaaaaaaaaa"] }
+}
+override_data {
+ target = data.aws_caller_identity.current
+ values = { account_id = "123456789012" }
+}
+override_data {
+ target = data.aws_ami.debian_arm64
+ values = { id = "ami-0123456789abcdef0" }
+}
+override_data {
+ target = data.aws_vpc.host
+ values = { cidr_block = "10.0.0.0/16" }
+}
+override_resource {
+ target = aws_sqs_queue.terminations
+ values = { arn = "arn:aws:sqs:eu-west-1:123456789012:carlos-test-host-terminations" }
+}
+override_resource {
+ target = aws_instance.host
+ values = { id = "i-0123456789abcdef0" }
+}
+override_resource {
+ target = aws_security_group.host
+ values = { id = "sg-0123456789abcdef0" }
+}
+override_resource {
+ target = aws_iam_role.host
+ values = { arn = "arn:aws:iam::123456789012:role/carlos-test-host" }
+}
+override_resource {
+ target = aws_eip.host
+ values = { public_ip = "192.0.2.10" }
+}
+
+variables {
+ name = "carlos-test-ie"
+ sg_description = "carlos test host"
+ iam_name = "carlos-test-host"
+ instance_type = "t4g.small"
+ root_volume_size = 20
+ deployment_bucket_arn = "arn:aws:s3:::carlos-test-platform"
+ data_bucket_arn = "arn:aws:s3:::carlos-test-ie"
+ ssm_parameter_arn = "arn:aws:ssm:eu-west-1:123456789012:parameter/carlos/*"
+}
+
+run "first_boot_script" {
+ command = apply
+ variables {
+ user_data = "#!/bin/sh\necho first\n"
+ }
+ assert {
+ condition = aws_instance.host[0].user_data == "#!/bin/sh\necho first\n"
+ error_message = "a new box must boot with the given user_data"
+ }
+}
+
+run "edited_script_leaves_the_live_box_alone" {
+ command = plan
+ variables {
+ user_data = "#!/bin/sh\necho first\n# a later edit to the deployment's host-init\n"
+ }
+ assert {
+ condition = aws_instance.host[0].user_data == "#!/bin/sh\necho first\n"
+ error_message = "a user_data edit must not plan a change to the live instance (it would stop and start the box)"
+ }
+}
+
+run "other_instance_changes_still_plan" {
+ command = plan
+ variables {
+ user_data = "#!/bin/sh\necho first\n"
+ instance_type = "t4g.medium"
+ }
+ assert {
+ condition = aws_instance.host[0].instance_type == "t4g.medium"
+ error_message = "ignoring user_data must not hide other instance changes"
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 4eab739b6..51af650d7 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -139,3 +139,4 @@ plan14-root-reads-dns-fresh-lookup-724.tsv 7ac2bde8301c37c7546e9aa19d375f1468fc8
plan14-root-reads-gvisor-update-dirs.tsv 1f1b2fdb569b7be42e75e10d1943d7e512708299364f912c2f72dccf1bd5b678
plan14-root-reads-region-ha-held-build.tsv beb085e4c6cdb3d430d12a8dc3c93f25cc3faf1aa7d62be37698ff9c9c82ecce
plan14-root-reads-fixedbox-health-alarms.tsv 0f7153571df8c1b4b50c31f57efcfdf60c71a12c80fd935fb3ea202fa0201dd5
+plan14-root-reads-fixed-host-ignore-user-data.tsv 250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129
diff --git a/internal/provision/testdata/plan14-root-reads-fixed-host-ignore-user-data.tsv b/internal/provision/testdata/plan14-root-reads-fixed-host-ignore-user-data.tsv
new file mode 100644
index 000000000..e53534521
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-fixed-host-ignore-user-data.tsv
@@ -0,0 +1,9 @@
+# Census overlay fixed-host-ignore-user-data, written by census-propose (#369). census-ruling-fixed-host-ignore-user-data, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-fixed-host-ignore-user-data.md.
+# 1 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 3a71392fd583e21250935b1bc71f34b777601607c8b1336a4f5b9a24d6677e63 infra/modules/region-host/main.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's module with one optional aws_iam_role_policy, host_console_mail, count 0 unless console_mail_from is set; it grants the host role ses:SendEmail on the one sending identity, the carlos-bab configuration set and its tenants, conditioned on ses:FromAddress equal to console_mail_from; no read is added and nothing on a box reads the file;rev3=census-ruling-sec-host-imdsv2-module;basis=aws_instance.host gains metadata_options (IMDSv2 required, hop limit 1, endpoint enabled), matching scanner-host; tofu configuration only, run on an operator's machine; no read, file or record write is added; applies in place on a running instance with no restart;rev3=census-ruling-hunt-account-root-hardening;basis=adds aws_iam_role_policy host_release_key_deny (count from deny_release_key_reads, default true): an explicit Deny on ssm:GetParameter, GetParameters and GetParameterHistory for parameter/carlos/release-key, and on GetParametersByPath for its ancestor paths; tofu only, run on an operator's machine; no read is added and nothing on a box reads the file;rev3=census-ruling-region-host-store-deny;basis=host_store policy: the explicit Deny on the deployment's own buckets drops s3:DeleteObject and keeps s3:DeleteBucket and s3:CreateBucket (lease release, retention and prune are DeleteObject); tofu only, run on an operator machine; no read is added and nothing on a box reads the file;rev3=census-ruling-region-ha-p3b;basis=Select default fixed resources through counted addresses and explicit moves; group mode selects scoped bucket/SSM policy, partition-aware ARNs and refuses fixed-only settings. Operator Terraform controls the instance role that can read boot parameters and write runtime bucket objects; release-key Deny and fixed-mode policy remain.;rev3=census-ruling-region-ha-g3-fixes;basis=Enable the fixed-host memory alarm with either alert input and use the selected topic for alarm and recovery notifications. Preserve module topic/subscription creation for alerts_email only. No new root runtime read or box authority.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: aws_iam_policy.store_user_boundary is now counted when store_bucket_prefix is set or managed_fleets_enabled is true; its statements are concat of the unchanged object-storage pair (only with a store prefix, moved into local.store_boundary_statements byte for byte) and local.managed_boundary_statements (only with managed fleets: the fleet-data Allows on <managed_fleet_bucket_prefix>* buckets); name unchanged, description conditional on store prefix with lifecycle ignore_changes on description so a later feature switch never replaces the policy; tofu only, run on an operator's machine with the operator's AWS credentials; no box unit, user_data or binary reads the file; no read is added; default (both features off) plans no change;rev3=census-ruling-fixedbox-health-alarms;basis=Fixed host EC2 status-check alarms: auto-recover gains SNS alarm/ok actions (ec2:recover kept); new host_instance_check alarm (StatusCheckFailed_Instance 3 of 3 x 60 s -> ec2:reboot + SNS). tofu only, run on an operator machine; no read is added and nothing on a box reads the file.;rev3=census-ruling-fixed-host-ignore-user-data;basis=aws_instance.host lifecycle ignore_changes gains user_data (was [ami]): a user_data edit no longer plans an in-place update (stop/start) of a live fixed host; a new box still boots with the given script. tofu only, run on an operator machine; no read is added and nothing on a box reads the file. file:external@0 00f9d59edc92520343d6ea3b3a8f108ff9d3d6f4743b5c07a5a10c6c6241ca88
+@legacy 13ee6f2a963a7e67d9dbd47285a9400aa57584f9f9ccea2cd5264b6fd7b55ba5 infra/modules/region-host/tests/user_data_ignored.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-fixed-host-ignore-user-data;basis=New mock-provider tofu test file (apply then plan against the mock); runs only under tofu test on a developer machine, nothing on a box reads it. file:external@0 0527a5b4218b8c193788212035494815a18c50ba28efde41e9224ab7c59ea8e9
+infra/modules/region-host/main.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's module with one optional aws_iam_role_policy, host_console_mail, count 0 unless console_mail_from is set; it grants the host role ses:SendEmail on the one sending identity, the carlos-bab configuration set and its tenants, conditioned on ses:FromAddress equal to console_mail_from; no read is added and nothing on a box reads the file;rev3=census-ruling-sec-host-imdsv2-module;basis=aws_instance.host gains metadata_options (IMDSv2 required, hop limit 1, endpoint enabled), matching scanner-host; tofu configuration only, run on an operator's machine; no read, file or record write is added; applies in place on a running instance with no restart;rev3=census-ruling-hunt-account-root-hardening;basis=adds aws_iam_role_policy host_release_key_deny (count from deny_release_key_reads, default true): an explicit Deny on ssm:GetParameter, GetParameters and GetParameterHistory for parameter/carlos/release-key, and on GetParametersByPath for its ancestor paths; tofu only, run on an operator's machine; no read is added and nothing on a box reads the file;rev3=census-ruling-region-host-store-deny;basis=host_store policy: the explicit Deny on the deployment's own buckets drops s3:DeleteObject and keeps s3:DeleteBucket and s3:CreateBucket (lease release, retention and prune are DeleteObject); tofu only, run on an operator machine; no read is added and nothing on a box reads the file;rev3=census-ruling-region-ha-p3b;basis=Select default fixed resources through counted addresses and explicit moves; group mode selects scoped bucket/SSM policy, partition-aware ARNs and refuses fixed-only settings. Operator Terraform controls the instance role that can read boot parameters and write runtime bucket objects; release-key Deny and fixed-mode policy remain.;rev3=census-ruling-region-ha-g3-fixes;basis=Enable the fixed-host memory alarm with either alert input and use the selected topic for alarm and recovery notifications. Preserve module topic/subscription creation for alerts_email only. No new root runtime read or box authority.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: aws_iam_policy.store_user_boundary is now counted when store_bucket_prefix is set or managed_fleets_enabled is true; its statements are concat of the unchanged object-storage pair (only with a store prefix, moved into local.store_boundary_statements byte for byte) and local.managed_boundary_statements (only with managed fleets: the fleet-data Allows on <managed_fleet_bucket_prefix>* buckets); name unchanged, description conditional on store prefix with lifecycle ignore_changes on description so a later feature switch never replaces the policy; tofu only, run on an operator's machine with the operator's AWS credentials; no box unit, user_data or binary reads the file; no read is added; default (both features off) plans no change;rev3=census-ruling-fixedbox-health-alarms;basis=Fixed host EC2 status-check alarms: auto-recover gains SNS alarm/ok actions (ec2:recover kept); new host_instance_check alarm (StatusCheckFailed_Instance 3 of 3 x 60 s -> ec2:reboot + SNS). tofu only, run on an operator machine; no read is added and nothing on a box reads the file.;rev3=census-ruling-fixed-host-ignore-user-data;basis=aws_instance.host lifecycle ignore_changes gains user_data (was [ami]): a user_data edit no longer plans an in-place update (stop/start) of a live fixed host; a new box still boots with the given script. tofu only, run on an operator machine; no read is added and nothing on a box reads the file. file:external@0 00f9d59edc92520343d6ea3b3a8f108ff9d3d6f4743b5c07a5a10c6c6241ca88
+infra/modules/region-host/tests/user_data_ignored.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-fixed-host-ignore-user-data;basis=New mock-provider tofu test file (apply then plan against the mock); runs only under tofu test on a developer machine, nothing on a box reads it. file:external@0 0527a5b4218b8c193788212035494815a18c50ba28efde41e9224ab7c59ea8e9
+@coverage infra/modules/region-host 27a9632b9e910c0818ebecefaaf1b5b454b36040fc4d103b4982b307968c6ce1
+@coverage infra/modules/region-host/tests d613d91d1e5178b70272acd5d351c8beedc34a4363bca26c5fd9dacb9026fba4