Skip to content

Commit ee640b4

Browse files
sir-sigurdclaude
andcommitted
Address review: README Test entry, wrapper cautions, internal smoke run
- README cheat sheet: add a Test entry documenting the plan-only/mocked, credential-free workflow and the Terraform >= 1.7 requirement. - quilt smoke wrapper: comment that new quilt inputs must be threaded through (or coverage silently narrows) and that the root must re-expose only the non-sensitive stack name. - Add an internal = true new-VPC smoke run, exercising the PublicSubnets/ UserSubnets coalescing and the internal-gated api endpoint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 88682d7 commit ee640b4

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,18 @@ terraform fmt
917917
terraform validate
918918
```
919919

920+
## Test
921+
922+
Module tests are plan-only and mock the AWS provider, so they need no AWS
923+
credentials and create no infrastructure. Requires Terraform >= 1.7 (for
924+
`mock_provider`). Run from a module or test-wrapper directory, e.g.
925+
`modules/vpc` or `modules/quilt/tests/smoke`:
926+
927+
```
928+
terraform init -backend=false
929+
terraform test
930+
```
931+
920932
## Plan
921933
```
922934
terraform plan -out tfplan

modules/quilt/tests/smoke/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ variable "user_security_group" {
5757
default = null
5858
}
5959

60+
# New inputs added to the quilt module must be threaded through here, or the
61+
# smoke coverage silently narrows (the new input is never exercised).
6062
module "quilt" {
6163
source = "../../"
6264

@@ -73,6 +75,10 @@ module "quilt" {
7375
user_security_group = var.user_security_group
7476
}
7577

78+
# Re-expose ONLY the non-sensitive stack name. Do not output module.quilt.stack
79+
# (it embeds the DB URL + admin password) or any *_password value — a sensitive
80+
# root output makes `terraform test` fail, which is the whole reason this
81+
# wrapper exists.
7682
output "stack_name" {
7783
value = module.quilt.stack.name
7884
}

modules/quilt/tests/smoke/smoke.tftest.hcl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ run "new_vpc_plans" {
3030
}
3131
}
3232

33+
run "new_vpc_internal_plans" {
34+
command = plan
35+
variables {
36+
create_new_vpc = true
37+
internal = true
38+
}
39+
# internal = true exercises the most conditional wiring in quilt/main.tf:
40+
# the PublicSubnets/UserSubnets null-coalescing and the internal-gated api
41+
# endpoint.
42+
assert {
43+
condition = output.stack_name == "quilt-test"
44+
error_message = "The CloudFormation stack must be named after var.name"
45+
}
46+
}
47+
3348
run "existing_vpc_plans" {
3449
command = plan
3550
variables {

0 commit comments

Comments
 (0)