Repository navigation
Conversation
Tag the CloudFormation stack and every resource the quilt module creates with aws-apn-id-730278974607 = "pc:<code>", the code set by marketplace_product_code (default: pay-as-you-go). Closes #132. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The documented deployment policy lacks the S3 tagging permissions required by the new defaults, causing apply to fail with AccessDenied for callers using that policy.
1 open issue
What changed in this PR
Adds default AWS Partner Revenue Measurement attribution to Terraform-managed Quilt stacks, covering infrastructure created outside CloudFormation.
Changes:
- Adds a configurable Marketplace product code, defaulting to pay-as-you-go, with an empty-string opt-out.
- Passes attribution tags through the Quilt, VPC, database, and search modules.
- Adds tag assertions and documents configuration and upgrade behavior.
| File | Description |
|---|---|
| VARIABLES.md | Documents the product code and submodule tag inputs. |
| README.md | Explains attribution, overrides, and opt-out behavior. |
| modules/vpc/variables.tf | Adds the VPC module’s tag input. |
| modules/vpc/tests/validation.tftest.hcl | Checks that attachment tags preserve its name. |
| modules/vpc/main.tf | Passes tags to network resources and modules. |
| modules/search/variables.tf | Adds the search module’s tag input. |
| modules/search/main.tf | Tags the search domain and security groups. |
| modules/quilt/variables.tf | Adds the default Marketplace product code. |
| modules/quilt/tests/smoke/smoke.tftest.hcl | Checks default, custom, and omitted stack attribution. |
| modules/quilt/tests/smoke/main.tf | Exposes product-code input and stack tags for tests. |
| modules/quilt/main.tf | Constructs attribution tags and applies them across resources. |
| modules/db/variables.tf | Adds the database module’s tag input. |
| modules/db/main.tf | Passes tags to database and security-group modules. |
| CHANGELOG.md | Announces default tagging and in-place upgrade behavior. |
Review effort: Balanced
[Medium impact] The PR appears safe to merge, with no new blocking issues found. Reviews (2) · Last reviewed commit: "Leave the stack untagged and validate th..." · Reviewed by Greptile |
|
Looks good overall. This matches #132: paygo's product code by default, overridable, on the CloudFormation stack and on every resource the module creates. The tag wiring through Two nits:
The scope split with #3271 is intentional and fine: this module tags everything it creates, per #132; the template tags only the cost drivers. |
The CloudFormation template tags the stack's own resources, so the module tags only the resources it creates, and rejects a product code carrying the "pc:" prefix at plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Both nits are addressed in 4e56c11.
The tests that read the default and custom codes off the stack went with the stack's tag, since no output exposes the tags of resources the module creates. In their place, read-only plans of the nightly root at the default code, a custom code and |
|
@greptileai re-review at head 4e56c11, please — the stack is no longer tagged (the template tags its own resources), and marketplace_product_code now rejects a pc:-prefixed value. |
|
Re-reviewed at
CI is all green (fmt, validate, module tests, markdownlint). Greptile is at 5/5 on this head, and Copilot's later pass recommends approval with the S3-policy thread resolved. The PR is mergeable, with |

The need
Closes #132. On a Terraform-managed stack the VPC, database and search domain are created by this repository's modules, not by the CloudFormation template, so AWS Partner Revenue Measurement (PRM) attribution for them has to come from the module. Every resource the module creates is to carry
aws-apn-id-730278974607 = "pc:<product code>"by default, with pay-as-you-go's product code unless the caller sets another. The CloudFormation template tags the stack's own resources (https://github.com/quiltdata/deployment/pull/3271), so the stack itself is left untagged here, and the key has one writer per resource. No IAM or permission change is part of it.What changed
quiltmodule variablemarketplace_product_code, default1xn1f7bxkj2dc16ak28s0dbgk(pay-as-you-go). The module tags the template bucket and object and everything in thevpc,dbandsearchsubmodules withaws-apn-id-730278974607 = "pc:<code>". It does not tag the CloudFormation stack, whose tags CloudFormation would also copy onto the template's resources, which the template tags itself.pc:prefix, such as a pasted tag value, fails at plan.marketplace_product_codeomits the tag. I chose to allow this so that a stack that must not carry the attribution can drop it without forking the module.vpc,dbandsearchgain atagsinput (default{}), passed to every registry module and resource they use. The Transit Gateway attachment merges it with its existingNametag rather than replacing it.marketplace_product_codeto the template variant's code (pay-as-you-go by default on both sides); do not put the key in providerdefault_tags, which also reach the CloudFormation stack. VARIABLES.md and the CHANGELOG release notice match.Verification
terraform fmt -check -recursive,terraform validatein every module,terraform testinmodules/vpcandmodules/quilt/tests/smoke, andmarkdownlint-cli2all pass locally, as in CI. The smoke tests pin that the stack carries no partner tag and that apc:-prefixed code is rejected. The vpc test pins the Transit Gateway attachment carrying both the tag and itsName.terraform plan -lock=falseof the nightly root (an existing stack with a database, a search domain and a new VPC) against this branch, at the default code, atf5d6l3y7x2yy2fcm0uxr9gglhand at"". Each shows 0 to add and 0 to destroy, with nothing replaced and the stack carrying no partner tag. At a code, all 31 taggable resources the module creates carrypc:<that code>; at""none does. For the database, search and VPC resources,tags/tags_allare the only attributes that change. Withmarketplace_product_code = "pc:1xn1f7bxkj2dc16ak28s0dbgk"the plan fails on the variable's validation.Links
Risk and rollback
marketplace_product_codeleft at its default, attributes the module's resources to pay-as-you-go and the stack's to its own listing. The README tells callers to set the variable to match.marketplace_product_code = ""or pin the previous module version; either removes the tag in place.The optionality note
This fixes the tag's account (Quilt's Partner Central account) in the module, and gives callers only the product code to choose. The module still has no general
tagsinput; the new submoduletagsinputs leave that door open.🤖 Generated with Claude Code