Skip to content

docs(toolkit-lib): fix resource import mapping docs to say keys are logical IDs - #1817

Merged
aws-cdk-automation merged 1 commit into
aws:mainfrom
go-to-k:docs-import-map-keys
Aug 18, 2026
Merged

docs(toolkit-lib): fix resource import mapping docs to say keys are logical IDs#1817
aws-cdk-automation merged 1 commit into
aws:mainfrom
go-to-k:docs-import-map-keys

Conversation

@go-to-k

@go-to-k go-to-k commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Problem

Two doc comments in packages/@aws-cdk/toolkit-lib/lib/api/resource-import/importer.ts describe the resource mapping keys as CDK construct tree paths:

  • importResourcesFromMap: @param importMap - Mapping from CDK construct tree path to physical resource import identifiers
  • The ResourceMap type doc, whose example uses construct-path keys such as "MyStack/MyS3Bucket/Resource"

The implementation matches the mapping keys against CloudFormation logical IDs (resource.logicalId in askForResourceIdentifiers, loadResourceIdentifiers and makeResourcesToImport; the type is also declared as { [logicalResource: string]: ... }, and ImportMap.resourceMap is documented as "Mapping logical IDs to physical names"). Following the doc comment and using construct paths as keys in --resource-mapping / --resource-mapping-inline results in Unrecognized resource identifiers and zero resources imported. The confusion is compounded by the interactive display (describeResource), which shows construct paths.

Fix

Correct both doc comments to say the keys are CloudFormation logical IDs, and use logical-ID keys in the ResourceMap example.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@codecov-commenter

codecov-commenter commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.38%. Comparing base (da37001) to head (6655142).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1817   +/-   ##
=======================================
  Coverage   90.38%   90.38%           
=======================================
  Files          80       80           
  Lines       12195    12195           
  Branches     1734     1734           
=======================================
  Hits        11022    11022           
  Misses       1139     1139           
  Partials       34       34           
Flag Coverage Δ
suite.unit 90.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@go-to-k go-to-k changed the title docs(toolkit-lib): resource import mapping docs say keys are construct tree paths, but they are logical IDs docs(toolkit-lib): document resource import mapping keys as logical IDs Aug 18, 2026
@go-to-k go-to-k changed the title docs(toolkit-lib): document resource import mapping keys as logical IDs docs(toolkit-lib): fix resource import mapping docs to say keys are logical IDs Aug 18, 2026
…onstruct tree paths, but they are logical IDs
@mrgrain
mrgrain force-pushed the docs-import-map-keys branch from efb7e02 to 6655142 Compare August 18, 2026 14:35
@mrgrain
mrgrain deployed to integ-approval August 18, 2026 14:36 — with GitHub Actions Active
@aws-cdk-automation
aws-cdk-automation added this pull request to the merge queue Aug 18, 2026
Merged via the queue into aws:main with commit b409e72 Aug 18, 2026
41 checks passed
@go-to-k
go-to-k deleted the docs-import-map-keys branch August 18, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants