Skip to content
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

Property name and type conflict between generated code and cdktf.ComplexComputedList #634

Closed
yamamoto-febc opened this issue Apr 14, 2021 · 3 comments · Fixed by #640
Closed
Assignees
Labels
bug Something isn't working

Comments

@yamamoto-febc
Copy link

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

cdktf & Language Versions

  • cdktf: 0.2.1
  • typescript: 4.2.4

Affected Resource(s)

Debug Output

https://gist.github.com/yamamoto-febc/2a29df295eee3a768d8f1259747473bd

Expected Behavior

It should compile.

Actual Behavior

Unable to compile with TS2416 and TS2411 errors.

Steps to Reproduce

Generate sacloud/sakuracloud provider bindings and compile - See here for a ready to go example: https://github.com/yamamoto-febc/cdktf-sakuracloud-example


In the community provider sacloud/sakuracloud, there is a field with the key name index, computed:true and TypeInt.
ref: https://github.com/sacloud/terraform-provider-sakuracloud/blob/4063b51a35a88163163b0c70cafd86702543863d/sakuracloud/data_source_sakuracloud_vpc_router.go#L101-L105

Here is the code generated using it: https://github.com/yamamoto-febc/cdktf-sakuracloud-example/blob/987794ad53d57fb596a15181d5809f06976fd4b9/.gen/providers/sakuracloud/data-sakuracloud-vpc-router.ts#L166-L169

The Class which extended cdktf.ComplexComputedList was generated, and a getter named index was generated.
In the original provider, it is defined as TypeInt, so it returns a number.

However, in cdktf.ComplexComputedList, index is defined as a string, which causes an error.

@yamamoto-febc yamamoto-febc added the bug Something isn't working label Apr 14, 2021
@ansgarm ansgarm self-assigned this Apr 15, 2021
ansgarm added a commit that referenced this issue Apr 15, 2021
…ions

resolves #634 which was caused by a terraform data source which had an attribute containing a list of items which each have a key 'index' which collided with its base class ComplexComputedList
@ansgarm
Copy link
Member

ansgarm commented Apr 15, 2021

Hey @yamamoto-febc! Thank you for providing this well described bug report containing an example which easily let me reproduce the error 👍

It is caused by a collision of the index property in the mentioned Terraform resource of the sakuracloud provider and the internal index which is used by the CDK for Terraform internally to be able to render references to its value.

I just added a pull request (#640) which renames the latter to something more specific to fix the collision.

@ansgarm
Copy link
Member

ansgarm commented Apr 22, 2021

Hi @yamamoto-febc,
just a heads-up: We released v0.3 yesterday which includes the fix for this bug 🙂

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants