-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(cli) cdk import : resource-mapping options doesn't work #30318
Comments
@sudhirkumar04 , Thanks for reporting this. I am able to repro the situation and resources are not getting imported however in my case, the error is a bit different which only says I am currently investigating the root cause and looking into it. Will share my findings soon if there is an alternate on how this could be achieved. |
thanks for looking into it @khushail |
@sudhirkumar04 , I understood your point in providing the resources through the file and I tried to repro the same scenario and faced similar error - As per my investigation, this code leads to reading the data from the file - aws-cdk/packages/aws-cdk/lib/cdk-toolkit.ts Line 551 in ba8edb3
which is invoking this module - aws-cdk/packages/aws-cdk/lib/import.ts Line 92 in ba8edb3
Looks like, the file is not being read properly and error is produced by contents being read as Unknown - aws-cdk/packages/aws-cdk/lib/import.ts Line 111 in ba8edb3
Since the direct option of passing the logical id exists through |
The issue here is that the resource mapping is looking for the entire ID, including the path, for the resource. It must be in the format of |
This is definitely a usability issue, but it is not a bug so I'm removing that label here. |
The docstring gives an example of what this should look like:
|
Leaving this for reference and assistance to others. This is definitely not a usability issue.
Again, the CdkrdsimportTopic215EE3043 (this a logical id) is retrieved from the manifest.json file. |
Describe the bug
cdk import --resource-mapping=resource-mapping.json
doesn't work. This returnsImportedKMSKey1, ImportedKMSKey2 are resource names
--resource-mapping option also return same result when it used after --record-resource-mapping
cdk import --record-resource-mapping=resource-mapping.json
// this command prompted for keyId twicecdk import -resource-mapping=resource-mapping.json
This returns same as above
Expected Behavior
cdk import --resource-mapping=resource-mapping.json
should import the resources mentioned in the resource-mapping.json fileCurrent Behavior
cdk import --resource-mapping=resource-mapping.json
doesn't work. This returnsImportedKMSKey1, ImportedKMSKey2 are resource names
Reproduction Steps
cdk import --resource-mapping=lib/config/dev.json
Possible Solution
cdk import works but it prompts the kms key id which is a pain for rolling out for different accounts and environment. In order to avoid prompting keyId, resource-mapping should allow to map the resource.
Additional Information/Context
No response
CDK CLI Version
2.122
Framework Version
No response
Node.js Version
21.7.1
OS
mac
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: