-
Notifications
You must be signed in to change notification settings - Fork 440
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
Generate Providers as Submodules #572
Comments
It would be pretty cool to use the common abbreviation / service name for this (e.g. |
Perhaps we could extract this information from the provider documentation. There is this subcategory attribute for each of the resources. This would make the implementation a bit more difficult, since we'd have to process the docs and implement the namespaces directly in the generated code, where one namespace would span multiple files. That's possible to do in Typescript and supported in jsii. Not exactly sure how the implementation would look like. Using it, would probably look like this: import { acm } from '@cdktf/aws-provider'
const new acm.AcmCertificate(this, 'foo', {}) |
AWS's CloudFormation-based CDK does just that so it'll be in line with that approach. |
Yes! Will have a more detailed look there as well 👍
That would be pretty neat :) |
Was playing around with jsii, I had to explicitly declare the namespace
Which resulted in separately rendered files per namespace - which I believe will be pretty good for Python and potentially other languages in terms of filesize. |
Here's the list of subcategories by the example of the AWS provider. So let's take the ACM category as an example:
This looks like something we could generate, and it seems to be reasonable at a first sight. This would result in a dedicated Let's look how intellisense handles this: In contrast to the current AWS provider: While we gain more structure, we'd loose the "full text" resource search we have right now. Probably an acceptable tradeoff -thoughts? |
As the "full text" search breaks for some IDEs / languages due to the size of the provider, I think using namespaces would be an improvement 👍 |
Besides the fact, that there isn't any documentation on this level - and no linkable website either. Perhaps we could maintain a service description mapping for a selection of providers? |
Jup, maybe that's something that could come in handy – some way to have a short description for those subcategories per terraform provider. |
Managing those lists by hand is a bit unfortunate, but given that switching namespaces is a breaking change, probably best to be more controlled than some automated grouping. |
Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
This change splits up the AWS providers into submodules, which we expect to speed up compile time on other languages and help with compilation issues when adding more classes / function exports per file Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
This change splits up the AWS providers into submodules, which we expect to speed up compile time on other languages and help with compilation issues when adding more classes / function exports per file Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
This change splits up the AWS providers into submodules, which we expect to speed up compile time on other languages and help with compilation issues when adding more classes / function exports per file Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
This change splits up the AWS providers into submodules, which we expect to speed up compile time on other languages and help with compilation issues when adding more classes / function exports per file Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
This change splits up the AWS providers into submodules, which we expect to speed up compile time on other languages and help with compilation issues when adding more classes / function exports per file Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
This change splits up the AWS providers into submodules, which we expect to speed up compile time on other languages and help with compilation issues when adding more classes / function exports per file Closes #572 BREAKING CHANGE: This changes the API surface of big providers and will require manual fixes for the imports e.g. aws.Route53Record becomes aws.Route53.Record
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
Description
cdktf
generates provider classes without namespaces and exports all generated classes and interfaces. Here's an example from the AWS provider:which can be used like the following in Typescript:
One major problem with this approach are naming conflicts. If
acm-certificate
andacm-certificate-validation
would export a type with the same name, the provider wouldn't compile anymore. (see #568 for a specific occurrence of this)Another issue which popped up quite frequently recently: In particular for the AWS provider, but potentially for all providers which consist of lots data sources / resources, some intellisense like analziers are not working out of the box due to code size limitations (the AWS provider is a single file with about 20 MB in Python). (see #464)
Submodules
jsii supports submodules, which are essentially Typescript namespaces. The example above could look like this:
which can be used like the following in Typescript:
I don't particularly like the namespace / name duplication here, but I don't really have a better idea right now.
The implementation seems to be pretty straightforward, it'll be a breaking change though.
References
The text was updated successfully, but these errors were encountered: