Repository navigation
Support ConnectPublic on internal Terraform stacks - #138
Conversation
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; the latest change only adds the missing changelog entry. Reviews (3) · Last reviewed commit: "Note the ConnectSecurityGroup plan-time ..." · Reviewed by Greptile |
There was a problem hiding this comment.
Review at head f3c17c99, against quilt-specs#214 (the iac unit) and Sergey's Dec 4 comment. I read the diff and compared it with deployment main's template:
ConnectPublic(Enabled/Disabled) is offered only on internal, network 2.0, non-WAF stacks.PublicSubnetsis an optionalCommaDelimitedList.- The
ConnectPublicNeedsPublicSubnetsrule applies to the existing-VPC variant.
Does it implement what #214 specifies? Yes. In the iac unit's own terms:
- It derives the opt-in from
parameters.ConnectPublic, so there is no second source of truth. - It passes module-created public subnets, or requires two distinct non-empty caller-supplied IDs on an existing VPC.
- It keeps the null rule when Connect is not public.
- It leaves
UserSubnetsand the main ALB untouched. - It does not widen the closed substrate key set.
CI is green: fmt, markdownlint, validate, and the mocked vpc and smoke tests. There is no review yet, and REVIEW_REQUIRED blocks the merge. No threads are open.
Findings
- P2: public Connect can be enabled on the Terraform path with no ingress guard.
- P3: the quilt smoke test for the module-created VPC path asserts only the stack name.
- P3: the PR body says fmt, validate and tests are "pending CI" and leaves the CI TODO unchecked, but all checks have passed. Please update it.
No P1.
Spec follow-ups once this merges. deploy#tf-apply and deploy#network still say the Terraform path cannot supply PublicSubnets. The verify unit in #214 correctly covers reconciling them after a real plan and apply.
(Posted by Shannon on behalf of Ernest.)
|
@greptileai re-review at head a881ab6, please — PR body restructured to the kind sections; code unchanged since the last round except the new precondition, mocked-apply test and docs. |
There was a problem hiding this comment.
🔵 Needs a closer look
Public ingress on private stacks depends on external deployment safeguards and live ALB replacement procedures that are outside this snapshot and cannot be validated by mocked AWS tests.
No open issues 🎉
What changed in this PR
Enables opt-in public Connect on internal Terraform stacks while keeping the main load balancer private.
Changes:
- Passes public subnets when
ConnectPublicis enabled and validates existing-VPC subnet inputs. - Requires a Connect security group when public Connect has allowed hosts.
- Adds validation and smoke tests, plus prerequisite and rollback documentation.
| File | Description |
|---|---|
| VARIABLES.md | Documents Connect parameters and subnet requirements. |
| README.md | Explains enablement, prerequisites, and rollback. |
| modules/vpc/variables.tf | Adds the internal connect_public input. |
| modules/vpc/tests/validation.tftest.hcl | Tests subnet validation and opt-in behavior. |
| modules/vpc/main.tf | Allows and validates public Connect subnets. |
| modules/quilt/variables.tf | Clarifies public subnet requirements. |
| modules/quilt/tests/smoke/smoke.tftest.hcl | Tests subnet wiring and security-group enforcement. |
| modules/quilt/tests/smoke/main.tf | Exposes inputs and outputs for smoke tests. |
| modules/quilt/main.tf | Wires Connect opt-in and adds the security-group precondition. |
| CHANGELOG.md | Records public Connect support. |
Review effort: Balanced
There was a problem hiding this comment.
Approving at head a881ab6.
Checked against quilt-specs#214 (56cf09cf, iac):
PublicSubnetsis passed only when the stack is public, or when the stack is internal andConnectPublicis Enabled in the existing parameter map. There is no second knob. The module's output overrides any caller-suppliedPublicSubnets. Private and Disabled paths still pass null, and the main ALB keeps its user/private subnets.- The VPC module takes
connect_public, derived by the quilt module. For an existing VPC it requires two distinct non-empty public subnet IDs when public Connect is on, and requires null otherwise (the old behavior). The module-created VPC always has public subnets, so it uses its own outputs. - The optional plan-time precondition fires when
ConnectPublicis Enabled,ConnectAllowedHostsis non-empty andConnectSecurityGroupis empty or absent. It defers unknown values to apply. The docs state that the deployment template rule (#3723) is the authority. - The tests cover private opt-in, opt-out and Disabled, public stacks, both VPC paths and missing or duplicate subnets. The negative precondition test expects the stack failure. A mocked apply asserts that the actual CFN
PublicSubnetsparameter equals the generated VPC public subnet output, which is theverifyrequirement, and that user subnets stay private. - All CI checks are green on a881ab6 (fmt, markdownlint, validate ×5, test ×2). The two review threads are resolved. The CHANGELOG Unreleased entry is rendered. README and VARIABLES.md match the behavior.
Non-blocking:
- The CHANGELOG entry doesn't mention the new
ConnectSecurityGroupplan-time check. Consider adding it, but there is no need to push for it. - I couldn't run Terraform on my box, so I'm relying on the green
testjobs. The live apply and the CFN-side rule check remain in the spec'sverifyunit.
The precondition is operator-visible (plan fails), so it gets its own entry alongside the public-subnet wiring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KCtustfJTmiNGXAwTmXwka
|
@greptileai re-review at head e4e71a0, please — adds a CHANGELOG entry for the ConnectSecurityGroup plan-time check; no code change since a881ab6. |
There was a problem hiding this comment.
🔵 Needs a closer look
Human review must confirm external eligibility/security rules, rollout prerequisites, and live AWS ALB replacement/rollback behavior for private-stack public ingress, which mocked tests do not validate.
No open issues 🎉
Review effort: Balanced
Description
The need
Operators of internal (private) Quilt stacks on the Terraform path cannot use the opt-in
ConnectPublicCloudFormation parameter shipped in deployment#3319: the module nullsPublicSubnetson every internal stack and the VPC module rejects caller-supplied public subnets there. This is theiacwork unit of quilt-specs#214, narrowed after quilt-specs#350.What changed
parameters.ConnectPublic = "Enabled"on an internal stack now suppliesPublicSubnetsto the template: the module-created public subnets, or, with an existing VPC, two distinct non-empty caller-supplied public subnet IDs (the VPC module rejects anything else). There is no new quilt module input; the existing parameter is the only source of truth.ConnectPublicEnabled keepPublicSubnetsnull;UserSubnets, the main ALB's scheme and public stacks are unchanged.ConnectSecurityGroupwhenConnectPublicis Enabled andConnectAllowedHostsis non-empty. Absent keys are handled and unknown values defer to apply. It is a subset of the template rule in deployment#3723, which stays the authority; the module does not inspect route tables, subnet suitability or security group rules.VARIABLES.mdand the variable descriptions state the prerequisites; CHANGELOG has an entry for the subnet wiring and one for the plan-time check.Verification
terraform fmt -check -recursive, thenterraform testinmodules/vpc(17 passed) andmodules/quilt/tests/smoke(12 passed), run locally on Terraform 1.14.2 at heada881ab69; the CI jobs of the same names (fmt, markdownlint, validate, both test suites) passed at that head.PublicSubnets/UserSubnetsparameters for existing-VPC opt-in, disabled, default and public stacks; a mocked apply compares the generated VPC output with the stack parameter on the module-created path; a plan test rejects a missing ingress group (it fails if the precondition is disabled).Links
Risk and rollback
No automatic public enablement and no new ingress resources:
ConnectPublicstays opt-in and the main ALB stays internal. CloudFormation validates template eligibility. To disable, setConnectPublic = "Disabled"and remove the existing-VPC public subnet input, using the documented Connect ALB replacement procedure where a running Connect ALB needs it. Do not enable on a customer stack without the required security review and both deployment#3723 and deployment#3269 shipped; the precondition does not inspect customer ingress rules.The optionality note
Opens the Terraform path to public Connect on internal stacks, which was closed before. It keeps
ConnectPublicas the single switch, so it forecloses no future ingress design (for example a dedicated Connect WAF ACL).TODO
🤖 Generated with Claude Code
https://claude.ai/code/session_01KCtustfJTmiNGXAwTmXwka