Add LogicalName to import system #14745
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #14618.
This adds a new field to the import file "logicalName", which if set is used as the logical name (https://www.pulumi.com/docs/concepts/resources/names/#logicalname) of the resource. The original "name" field is then used just for codegen purposes (i.e. the source name).
If either field is not set then the other field is used to fill it in. If neither field is set it's an error.
Further the import system no longer renames resources to try and make unique names, but it also no longer errors just because two resources of different types have the same name. The rules for uniqueness now match what's valid when writing a Pulumi program, but it is the users responsibility to make names unique and the import system will error if you try to import two resources that would end up with the same URN.
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change