terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

Skip generating empty interfaces for provider bindings

Open ansgarm opened this issue 4 years ago • 3 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

We currently generate empty interfaces which we could skip. See for example:

https://github.com/hashicorp/terraform-cdk/blob/880bb91aed2034ed94cdab01a97771d10dcc83f5/packages/%40cdktf/provider-generator/lib/get/tests/generator/snapshots/complex-computed-types.test.ts.snap#L52-L62

We should skip them in generation.

References

  • https://github.com/hashicorp/terraform-cdk/pull/1499#discussion_r821286723

ansgarm avatar Mar 17 '22 10:03 ansgarm

There are cases where an empty interface is required; basically it needs to be for an attribute that is assignable at the level above.

jsteinich avatar Mar 23 '22 05:03 jsteinich

Ah, thanks for researching! Should we close this then? Or can we properly determine when this is the case and when not?

ansgarm avatar Mar 23 '22 10:03 ansgarm

Ah, thanks for researching! Should we close this then? Or can we properly determine when this is the case and when not?

I think we should still try to fix since cutting down unused code should make things slightly faster. I think we'll just need to pass a bit more information to a struct during resource parsing.

jsteinich avatar Mar 24 '22 02:03 jsteinich