Improve mapping of resources & datasources #10
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.
Hello, Ringo here from Pulumi 👋🏻
You reached out via our support system regarding the incorrect naming of mapped datasources. When looking into your provider, I noticed you were not mapping types as it is usually done in Pulumi:
volcengine_cloud_identity_group
->volcengine.cloud_identity.Group
get...
:volcengine_cloud_identity_users
->volcengine.cloud_identity.getUsers
Until now, you also mapped the datasources to type closely resembling the resources pattern. This PR gives an example how it should be.
In this PR, I also applied a newer feature from the Terraform bridge called auto-mapping. Using
tks.MappedModules
, resources and datasources which follow part of the name, will be mapped to the correct corresponding Pulumi resource types or functions. However, if you still provide a custom mapping underResources
orDataSources
inprovider/resources.go
, then that will take precedence.Since function names changed, I made sure that auto-aliasing is active. This will result in new files getting generated in the SDKs for the correct names, with deprecations for the old names.
If, in the future, you want to bump from v0 to v1 of your provider, right before versioning the v1, replace the content of
provider/cmd/pulumi-resource-volcengine/bridge-metadata.json
with{}
, save and then rebuild everything withmake clean provider build_sdks
. This will remove all the deprecated types and give you a clean SDK again.Hope this helps.