Repository navigation
feat(app-yaml): adopt an existing RDS instance and Route53 record - #155
Merged
Merged
Conversation
Terraform Plan✅ No changes — infrastructure is up to date. Plan output |
Terraform Plan✅ No changes — infrastructure is up to date. Plan output |
databases[].adopt imports an existing Postgres instance through the new service-rds-adopted module (tags, deletion protection, final-snapshot settings only; prevent_destroy), host_env/port_env expose address and port, and routing.adopt_dns takes over an existing A record. Each adoption must be listed in ADOPTIONS in scripts/registry.py. Rebased onto routing.login (#158): routing accepts both login and adopt_dns, and service-routing takes login_rules and allow_dns_overwrite. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Alexanderamiri
force-pushed
the
feat/moresleep-adopt
branch
from
October 26, 2026 14:25
61dc156 to
9068a8a
Compare
Terraform Plan🚧 Changes detected — Plan: 0 to add, 1 to change, 0 to destroy. Plan outputLLM ReviewRisk: 🟢 LOW Plan makes one in-place update to a Cognito Google identity provider, changing only the authorize_url to add hd=java.no and prompt=select_account query parameters; no creates or destroys.
|
Alexanderamiri
added a commit
that referenced
this pull request
Oct 26, 2026
app.yaml calls/provides declare private app-to-app edges, optionally with OAuth scopes. Every app gets its own task security group and a Cloud Map name in the new javabin.internal namespace; app-peers-sync opens ingress only where both sides agree and manages the M2M resource servers and clients. The developer boundary protects the shared namespace and the private zone's records (6,067 of 6,144 bytes). Rebased onto routing.login (#158), RDS/DNS adoption (#155), Lambda log retention (#159, adds the app-peers-sync log group) and the app-auth-sync restart rules (#167). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Today app.yaml can only create resources.
javaBin/moresleep(sleepingpill.javazone.no) is moving onto the platform with no architectural change, so it has to keep two existing things:dbmoresleep(Postgres 17, public endpoint, serves the program API since 2021). Not in any Terraform state.sleepingpill.javazone.no.routing.hostwould fail on apply because the record already exists.moresleep also reads
DBHOSTandDBPORTseparately, but the RDS modules only exposeendpoint(host:port).What
app.yaml (validated in
scripts/generate-modules.py):databases[].adoptgeneratesmodule "rds_<name>"from the newterraform/modules/service-rds-adopted, plus:deletion_protection, an optionalbackup_retention_period, and the Terraform-only final-snapshot settings:skip_final_snapshot=false, a final snapshot id,delete_automated_backups=false.instance_class(required by the provider) is read from the live instance. Every other argument is inignore_changes, andprevent_destroyis set.instance_class,allocated_storage,engine_versionandmulti_azare rejected together withadopt.adoptis rejected for dynamodb or an invalid identifier.host_env/port_envmap toaddress/portoutputs.service-rdsgains anaddressoutput, and the adopted module'sportis a string.routing.adopt_dns: truepassesallow_dns_overwrite = truetoservice-routing, which setsallow_overwriteon the record, so Route53 UPSERTs the existing record instead of failing on CREATE. The value isnullwhen unset, so existing apps' records and generated files do not change.importblock on purpose. moresleep runs in parallel onmoresleep.javazone.nofirst and then changeshost. At that point the routing record address is already in state, so Terraform would skip an import and the replacement CREATE would fail.allow_overwritecovers both the fresh case and the host-change case.adoptandadopt_dnsonly validate when the identifier or host is listed for the app's team inADOPTIONSinscripts/registry.py. This PR listsmoresleep: rds dbmoresleep, dns sleepingpill.javazone.no. Why: Route53 records in the shared zones have no team ABAC, andDenyXTeamonly fires on resources tagged with another team. Without the allowlist, any team could take over another app's hostname (host: submit.javazone.no+adopt_dns: true), or adopt, tag away and later delete an untagged legacy database with one app.yaml line. The generator always runs from platformmain, so a team can't edit the list itself.<identifier>-final-<random_id hex>(stable per state), so a later delete/re-adopt cycle can't collide with an old snapshot. The module pinshashicorp/aws >= 5.40, < 6.0becausededicated_log_volumeis inignore_changes.app-yaml-reference.md(an "Adopting an existing PostgreSQL instance" section,adopt_dns,host_env/port_env),reusable-modules.md,terraform/modules/README.mdand the module table inCLAUDE.md.scripts/registry.py:MODULE_SOURCESgainsservice-rds-adopted.How verified
python3 -m unittest discover -s scripts/tests: 59 tests OK, 16 of them new inAdoptTest(3 cover the approval list: another team's database, another team adoptingdbmoresleep, an unapproved host). The existing fmt test now also runs on the moresleep fixture.terraform/lambda-src/tests: 64 OK.terraform fmt -check -recursive terraform/modulesis clean.terraform validatepasses forservice-rds-adopted,service-routingandservice-rds(init -backend=false).terraform planagainst the real account (local backend, admin profile, never applied):Plan: 1 to import, 0 to add, 1 to change, 0 to destroy(before the review fix; therandom_idsuffix now adds1 to add). The only diffs aredeletion_protection false -> true,tags_all(+5 default tags), and the Terraform-onlyskip_final_snapshot,final_snapshot_identifieranddelete_automated_backups. Engine, class, storage, security group, publicity, PI and monitoring are untouched.moresleep.javazone.no, all modules, local module sources):Plan: 1 to import, 22 to add, 1 to change, 0 to destroy. It stops only atreading IAM Role (javabin-ecs-exec-moresleep), which is created when themoresleepteam is registered (javaBin/registry#40).Follow-ups
master) and Postgres for JVM tests.dbmoresleepsits in the default VPC with the default SG open to0.0.0.0/0. This PR deliberately leaves the SG alone.0.0.0.0/0. All traffic to such an instance goes through the NAT and pays data processing.DenyXTeamprotects them) is still a security-workstream item. The approval list closes the app.yaml path, not hand-written Terraform.🤖 Generated with Claude Code