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

Unknown type tuple

Open benfortuna opened this issue 3 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

cdktf & Language Versions

Typescript

image

Affected Resource(s)

  • cdktf.json

image

  • module "environment" variables.tf

image

Debug Output

image

Expected Behavior

When using modules we should be able to use "typle" type for input variables.

Actual Behavior

Module generation fails when tuple type is used.

Steps to Reproduce

Important Factoids

References

  • #0000

benfortuna avatar Mar 10 '22 01:03 benfortuna

Need to update https://github.com/hashicorp/terraform-cdk/blob/8263964d3535c913ddab2770d3a7ecc61f53fa1e/packages/%40cdktf/provider-generator/lib/get/generator/module-generator.ts#L133 to have support for tuples.

jsteinich avatar Mar 10 '22 14:03 jsteinich

@jsteinich I want to solve this issue. I am new to community. Can you please help me ?

aayushharwani-aidash avatar May 05 '22 07:05 aayushharwani-aidash

@aayushharwani-aidash Happy to have your help. My previous comment links to the section of code that needs to be modified. Need to make sure tuple is included in the check and that a case is created to handle it.

https://github.com/hashicorp/terraform-cdk/blob/main/packages/@cdktf/provider-generator/lib/get/tests/generator/module-generator.test.ts would be a good place to add some test cases for the new type. You can basically just make a regular hcl file that contains variables of different tuple types and confirm that they work with test cases.

jsteinich avatar May 07 '22 16:05 jsteinich

@jsteinich @xiehan depend on code, seems object, list, set, map is being handled inside. So for this update, is it mean that type tuple also needs to be handled. Is my understanding correct?

kination avatar Jun 17 '23 11:06 kination

@jsteinich could you check the following? https://github.com/hashicorp/terraform-cdk/pull/2964

Seems it changes as

list(tuple([string, string, number])) => tuple[string,string,number][]

If it seems okay, I'll include several test cases 👍

kination avatar Jun 24 '23 04:06 kination

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[bot] avatar Sep 04 '23 01:09 github-actions[bot]