Repository navigation
Description
AWS::ApiGateway::Method's physical ID is the HTTP verb, so every GET in a stack is the same resource.
What substrate does
deployAPIGatewayMethod records the verb as the physical ID
(emulator/cfn_resources_v19.go:239):
dr := DeployedResource{LogicalID: logicalID, Type: "AWS::ApiGateway::Method", PhysicalID: httpMethod}httpMethod is the template's HttpMethod property — GET, POST, ANY. It carries
neither the REST API ID nor the resource ID, both of which the helper already has in hand
(restAPIID and resourceID, used to build the PUT /restapis/{id}/resources/{id}/methods/{verb}
path two lines above).
What that costs
A template with a GET on /pets and a GET on /pets/{id} — the ordinary shape — deploys
two AWS::ApiGateway::Method resources whose physical ID is the string GET for both. So:
DescribeStackResourcesreports two resources with the samePhysicalResourceId.!Refon either resolves toGET, which identifies nothing.(*CFNStackState).deployedResource's physical-ID fallback cannot tell them apart on a
redeploy.- Any future
cfnResolveStampTargetarm for the type would build one state key for both,
which is the SQS state keys disagree: the tagging API and the authorizer address queue:<name>, the plugin writes queue:<account>/<name> #826 / The Resource Groups Tagging API cannot write tags for eleven types: mergeResourceTags has no arm #835 defect class arriving by a different route.
What AWS documents
AWS::ApiGateway::Method, Return values → Ref:
When you pass the logical ID of this resource to the intrinsic
Reffunction,Refreturns
the method ID, such asmysta-metho-01234b567890example.
That is a minted unique ID, not the verb, and it is the only return value the type
documents — the page has no Fn::GetAtt section at all.
Why it was recorded rather than fixed in #827
#827 fixed the values substrate retains somewhere. The method ID is not one: nothing in the
API Gateway plugin mints it, so Ref had nothing correct to resolve to. The divergence is
recorded in docs/services.md under "recorded rather than fixed":
AWS::ApiGateway::Method— the documented value is the method's ID, which substrate does
not mint; the physical ID is the HTTP verb. EveryGETmethod in a stack therefore shares
one physical ID.
Filing it separately because minting the ID is a change to the API Gateway plugin's own
PutMethod, not to the intrinsic resolver — the same reason Ref was not allowed to change
PhysicalID.
Acceptance criteria
- The API Gateway plugin mints a method ID on
PutMethod, in AWS's shape (a short
opaque string; AWS's example ismysta-metho-01234b567890example) and derived
deterministically from the request so a replay produces the same one. -
GetMethodreports it, so a caller can read back what a stack created. -
deployAPIGatewayMethodrecords the minted ID asPhysicalID; the verb, REST API ID
and resource ID go todr.Metadataif they are needed by a resolver. -
!Refon a method resolves to the method ID. - Two methods on different resources of the same API have different physical IDs, and
DescribeStackResourcesreports both. - The
docs/services.md"recorded rather than fixed" entry for the type is removed and
theReftable row is corrected. - Whether
AWS::CloudFront::CloudFrontOriginAccessIdentity(the same defect: the physical
ID is the configuredComment) is fixed here or separately is decided and recorded.
Activity
scttfrdmn commentedon Sep 14, 2026
Researched this before implementing. The core defect verifies exactly, and two of the issue's criteria are unimplementable within substrate's scope and are reversed with citations. Recording that here before the PR.
The defect verifies, and is worse than the issue states
emulator/cfn_resources_v19.go:239setsPhysicalID: httpMethod, so everyAWS::ApiGateway::Methodin a stack is identified by its HTTP verb. Two methods with the same verb on different resources are indistinguishable inDescribeStackResources.And because a
PhysicalResourceId-only request scans every stack in the account (cloudformation_plugin.go:632-636, filter at:661),describe-stack-resources --physical-resource-id GETreturns everyGETmethod in every stack, not just the one asked about.!Refon a Method resolves to the verb too (cfn_deployer.go:5222-5226—cfnRefValuehas no arm for the type, so Ref falls through to the physical ID).AWS's Template Reference is unambiguous, and this is the whole warrant for the fix:
That is CloudFormation's own generated-physical-name shape —
{stack}-{logical}-{suffix}, segments truncated, lowercased.Reversed: the two criteria asking the API Gateway plugin to mint a method ID
AWS's REST API has no method identifier.
API_Method's members are exactly the eleven configuration fields with noid, andAPI_PutMethodreturns those members with no identifier at all — its sample response carries only_links,apiKeyRequired,authorizationTypeandhttpMethod. Asking the plugin to mint and return a method ID would invent a member AWS does not publish, which is out of scope under #671.The plugin also already keys methods correctly:
apigwMethodKey(accountID, region, apiID, resID, verb)(apigateway_types.go:284-286) disambiguates fully. There is no service-state collision here at all — the defect is purely in the CloudFormation layer's reported identifier.So the fix is entirely CFN-side, and it needs no new mechanism:
cfnGeneratedName(cfn_physical_name.go:108) already produces exactly AWS's documented shape, deterministically, with the suffix derived by FNV-64a rather than randomly — for the reason its own doc comment gives, thatUpdateStackin substrate is a re-Deploy, so a random suffix would change on every update.AWS::ApiGateway::Methodis simply absent fromcfnGeneratedNameTypes. No plugin change, and nocfnRefValuearm either, because AWS'sRefis the method ID.The load-bearing consequence, and a correction to how the plan said to handle it
cfn_delete.go:313builds the DELETE path using the physical ID as the verb, with:306documenting that. Changing the physical ID breaks stack deletion for every Method unless the deleter sources the verb in the same commit — which it does.The verb comes from
props, not fromdr.Metadata, and the reason is this page:AWS::ApiGateway::Methodhas noFn::GetAttsection at all.dr.Metadatais a generic GetAtt channel —cfnGetAttValue's step 2 resolves any metadata key by its own name (cfn_intrinsics.go:150-158) — so recordingHttpMethodthere would make!GetAtt MyMethod.HttpMethodresolve to a value AWS does not publish an attribute for. That is the same "invent a member AWS does not have" defect this release fixed in IAM's permissions boundary, so it is not the channel to use.propshas no such cost and no durability disadvantage: the deleter already sourcesRestApiIdandResourceIdfrom it, delete-time props come from the storedstack.TemplateBody(cfn_delete.go:725-732) rather than a live template, and when that template no longer parses the deleter already returns nil for a Method because it cannot resolve the API and resource IDs. So Metadata would buy nothing the deleter can act on. Deploy and delete now resolve the verb through one helper so they cannot drift.Also overstated in the issue
(*CFNStackState).deployedResource(cfn_deployer.go:437) matches on logical ID, and recognition isclearUnchangedRedeploys(cfn_rollback.go:209), whose own comment explains why the physical ID cannot be the key.cctx.resourcesis keyed by logical ID, so nothing there is affected.Methodarm incfnResolveStampTarget, so theaws:cloudformation:*stamp cannot collide either.The sibling defect in the last criterion: verified, and worse than described — filing separately
deployCloudFrontOAI(cfn_resources_v23.go:101-114) is now checked againstaws-resource-cloudfront-cloudfrontoriginaccessidentity.html, which says:Two findings, not one. The issue says the physical ID is the comment; in fact it is the logical ID, because
resolveStringProp(props, "CloudFrontOriginAccessIdentityConfig.Comment", logicalID, cctx)looks up a dotted key in a flat map andCloudFrontOriginAccessIdentityConfigis a nested object, so the lookup never matches and the fallback always wins. Either way it is not an OAI ID.This is not folded into this PR, deliberately. The helper is a pure stub — it dispatches no request at all — and fixing it properly means deciding how to mint an
E-prefixed 14-character identifier deterministically (a format AWS publishes only by example, socfnGeneratedName's{stack}-{logical}-{suffix}shape is wrong for it), plus whether the two documentedFn::GetAttattributes —IdandS3CanonicalUserId— should resolve. That is its own decision with its own citation, so it gets its own issue rather than riding along here.One more finding, recorded not fixed
HttpMethodisRequired: Yeson this type, anddeployAPIGatewayMethoddefaults it to"GET"when absent. Defaulting a required member is the same defect class as #755'sCreateIPSet, but CloudFormation-side required-property validation is a general feature substrate does not have anywhere, so widening this issue to add it for one type would be inconsistent rather than complete. Recorded here so it is not lost.