-
Notifications
You must be signed in to change notification settings - Fork 57
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
tools/importer-rest-api-specs
: refactoring the terraform
package to use the standard SDK Types
#4248
Conversation
be989d4
to
a8ec26a
Compare
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.
LGTM 🥮
// | ||
// NOTE: this should only be used within the `terraform` package - with the SDK Model `TerraformResourceDefinition` | ||
// used elsewhere. | ||
type WorkInProgressResource struct { |
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.
Whilst it would necessitate more imports, is it worth having nested internal
packages here?
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.
Yeah I wondered the same here tbh, I ended up deciding against it because the paths felt too long? Particularly when bringing in the API Definitions Parser, which is a bunch of nested directories, but perhaps that's something we fix in a follow-up when the Parser logic is refactored too?
...mporter-rest-api-specs/internal/components/terraform/testing/generate_provider_block_test.go
Outdated
Show resolved
Hide resolved
…to the new SDK Types/a new directory structure Trying to refactor this in-place is a bunch more effort than refactoring the existing logic into a new package, so this temporarily duplicates the files until the entire `terraform` package is refactored, to allow for a cleaner refactor. This also gives the benefit of writing documentation for these as we go.
…into the Schema package, since it's schema related
…kage over to the new structure
… use the SDK Types This is another clean-cut using only the newer SDK types, the older logic will be cleaned up separately in a bit
…e things simpler
…terraform/schema`
…ntification stage This is where the WIP data is built-up, so it might as well start here
…ge over Additional refactoring is needed here, as is documentation - but we need the codepaths re-enabled first
…WIPResource, so that we have this information as needed
…ier flattening The structure may change post-refactoring to simplify this, but it's fine for now
… use the new `terraform` package
…ackage and remnants
a8ec26a
to
327916f
Compare
This PR:
terraform
package from./tools/importer-rest-api-specs/components/terraform
into `./tools/importer-rest-api-specs/internal/components/terraform'terraform
package to both use and return the SDK Models rather than the legacyresourcemanager
modelsIn order to make this work, it's been considerably easier to duplicate the package, refactor it, and then to remove the old one - so the diff for this may be a little strange, but this is ultimately copying, refactoring and then removing the old logic - but fundamentally there's little changed here.
Part 13 of #3754