-
Notifications
You must be signed in to change notification settings - Fork 52
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
Preparation for devcenter gallery resource generation #3271
Conversation
jiaweitao001
commented
Nov 2, 2023
- tools/importer-rest-api-specs: adding support for shared image gallery as a dependency.
17 Resource ID(s) found for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @jiaweitao001.
Overall it looks like this resource is a good candidate for generation. There are some bits that we have to workout though.
-
It seems that you've commited all of the changes that happen when you run the importer with your updates. You need to remove these since these will be added by an automatically generated PR which updates the data under
data/Pandora.Definitions.ResourceManager
.
To repeat: we should not be committing any changes todata/Pandora.Definitions.ResourceManager
ourselves. -
Since it's a dependency, we probably want to add the
shared_gallery_id
as a commonid inpandora
as well asgo-azure-helpers
before finalising the generation of this resource.
If you look through the PR history on pandora
and go-azure-helpers
you should be able to find examples on how that is done.
Do reach out if you have questions or need help. Thanks!
@@ -160,6 +168,7 @@ func DetermineDependencies(field, providerPrefix string, dependencies *testDepen | |||
dependencyMapping := map[string]dependencyDefinition{ | |||
"application_insights_id": {dependencies.setNeedsApplicationInsights, fmt.Sprintf("%s_application_insights.test.id", providerPrefix)}, | |||
"dev_center_id": {dependencies.setNeedsDevCenter, fmt.Sprintf("azurerm_dev_center.test.id")}, | |||
"gallery_resource_id": {dependencies.setNeedsSharedImageGallery, fmt.Sprintf("%s_shared_image_gallery.test.id", providerPrefix)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name doesn't follow the convention in the provider or for any of the other dependencies in this list - it's implicit that everything is a resource. This should be called
"gallery_resource_id": {dependencies.setNeedsSharedImageGallery, fmt.Sprintf("%s_shared_image_gallery.test.id", providerPrefix)}, | |
"shared_gallery_id": {dependencies.setNeedsSharedImageGallery, fmt.Sprintf("%s_shared_image_gallery.test.id", providerPrefix)}, |
6a34c3f
to
c6a6ec0
Compare
Hi @stephybun , thanks for the feedback. I've updated the PR as suggested. |
Hi @stephybun , after changing the name of |
@jiaweitao001 point 2. in my comment will fix this issue.
We have a doc/guide on this topic which you can follow: commonids |
Hi @stephybun , I have the commonid related PRs merged: hashicorp/go-azure-helpers#191 , #3285 |
b759a59
to
b26a553
Compare
Hi @stephybun , I tried to rebase this PR but it looks like the error is still the same. Could you please kindly point out where the commonid related change do its magic and resolves the resource mapping issue? Thanks! |
@stephybun , in my understanding the mapping of this property is directly mapping the name in Swagger to the resource name in azurerm. I'm not very sure how this is related to the |
@jiaweitao001 it looks like some additional changes are needed since the property Since it's nearing thanksgiving in the US we have a few people out so a lot going on. Please bear with me, I will try take a look this week. |
@jiaweitao001 I pushed a commit that adds the missing piece, which is to rename This should generate now without issues, however before we can merge this we need to add the Dev Center Resource ID as a common ID as well. Pandora is currently correctly identifying that Dev Center Gallery is a child resource of Dev Center, so the generated resource uses the Parser defined in
This throws a linting error because this method doesn't exist. Can you please add the Dev Center ID as a common ID, then rebase this PR once that's been merged. This should be good to go then. |
@stephybun Here is the PR for Dev Center ID as common ID: hashicorp/go-azure-helpers#199 |
13e8755
to
8e29544
Compare
8e29544
to
cabf0e8
Compare
cabf0e8
to
55248cd
Compare
55248cd
to
4937e25
Compare
Hi @stephybun , looks like the checks have all passed. Is there any chance that this PR can get merged? |
Thanks @jiaweitao001. I took a look and the resource definition looks fine. Generating the resource works and the output looks good, however:
The easiest way to work around this would be to handwrite the tests but that would require the ability to toggle generation of the tests, unfortunately we do not have this functionality yet. I recognise that it's cumbersome at the moment to work with generated resources, testing simple and small changes require several manual steps and intervention. Since it's quite time consuming, until we have more automation and tooling for Pandora we would appreciate it if in future you would verify the viability of the resource by generating it and running the tests on your end. Generally speaking it is also prudent to manually test the API (even seemingly simple ones) to ensure there is a full understanding of it's requirements and behaviour. This makes it possible for us to identify any potential gaps in Pandora ahead of time that could end up being blockers in the end. Despite all of the work put into this it looks like this will need to be handwritten after all. |
Closing in favour of hashicorp/terraform-provider-azurerm#23760 |
Hi @stephybun , thanks for all the hard work and time spent on this issue. I totally understand that we are now at the exploring stage on code gen with Pandora. At first this resource seems like a pretty simple one and a good candidate for code gen, even things went south at last but still it's a good practice for us to grok how we can use this tool. Really appreciate your help on this! |
This [isn't actually a generated resource](hashicorp/pandora#3271) and so shouldn't be marked as such else it'll be removed by the automation as in #24805
This [isn't actually a generated resource](hashicorp/pandora#3271) and so shouldn't be marked as such else it'll be removed by the automation as in #24805