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

cdktf-cli: v0.18.1+ generates duplicated variables in modules #3250

Closed
1 task
a0s opened this issue Nov 3, 2023 · 4 comments · Fixed by #3439
Closed
1 task

cdktf-cli: v0.18.1+ generates duplicated variables in modules #3250

a0s opened this issue Nov 3, 2023 · 4 comments · Fixed by #3439
Assignees
Labels

Comments

@a0s
Copy link

a0s commented Nov 3, 2023

Expected Behavior

Should generate code without duplicated variables
see source terraform module

Actual Behavior

// generated by cdktf get
// ./submodules/a0s/asg-dns-handler
import { TerraformModule, TerraformModuleUserConfig } from 'cdktf';
import { Construct } from 'constructs';
export interface AsgDnsHandlerConfig extends TerraformModuleUserConfig {
  /**
  * asg_dns_handler
  */
  readonly autoscaleHandlerUniqueIdentifier: any;
  /**
  * The ARN of route53 zone associated with autoscaling group
  */
  readonly autoscaleRoute53ZoneArn: any;
  /**
  * Use public IP instead of private
  */
  readonly usePublicIp?: boolean;
  /**
  * The name of the VPC
  */
  readonly vpcName: any;
  /**
  * asg_dns_handler
  */
  readonly autoscaleHandlerUniqueIdentifier: any;
  /**
  * The ARN of route53 zone associated with autoscaling group
  */
  readonly autoscaleRoute53ZoneArn: any;
  /**
  * Name of tag with hostname pattern
  * asg:hostname_pattern
  */
  readonly hostnameTagName?: string;
  /**
  * Use public IP instead of private
  */
  readonly usePublicIp?: boolean;
  /**
  * The name of the VPC
  */
  readonly vpcName: any;
}

Steps to Reproduce

{
  "terraformModules": [
    {
      "name": "asg-dns-handler",
      "source": "git::https://github.com/a0s/terraform-aws-asg-dns-handler.git"
    }
  ]
}
  1. cdktf get

Versions

cdktf: 0.18.1
npm: 8.19.2
node: v18.18.2
terraform: v1.5.7 on darwin_arm64

Providers

"terraformProviders": [
"hashicorp/aws@ ~> 4.61.0",
"hashicorp/external@ ~> 2.2.2",
"hashicorp/helm@ ~> 2.11.0",
"hashicorp/kubernetes@ ~> 2.22.0",
"hashicorp/local@ ~> 2.2.3",
"hashicorp/null@ ~> 3.1.1",
"hashicorp/random@ ~> 3.3.2",
"hashicorp/cloudinit@ ~> 2.2.0",
"hashicorp/tls@ ~> 4.0.1",
"integrations/github@ ~> 5.18.0"
],

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

CDKTF 0.18.1, 0.18.2 and 0.19.0 are suffering

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

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
@a0s a0s added bug Something isn't working new Un-triaged issue labels Nov 3, 2023
@ansgarm
Copy link
Member

ansgarm commented Nov 16, 2023

Hi @a0s 👋

I just tried to reproduce this with CDKTF 0.19.0 and was unable to do so 🤔

Is there maybe a chance you could share a git repository with a reproducible example?
Here's the repo I tried it with, maybe it fails for you locally?

@a0s
Copy link
Author

a0s commented Nov 16, 2023

@ansgarm thank you for answer! i will check repo and come to you

@a0s
Copy link
Author

a0s commented Nov 17, 2023

@ansgarm Seems i found the reason. In short, i have this in my configuration:

{
  "language": "typescript",
  "app": "npx ts-node main.ts",
  "projectId": "e6e97310-9442-48c3-a006-ef8faa489d95",
  "sendCrashReports": "true",
  "terraformProviders": [],
  "terraformModules": [
    "meltwater/asg-dns-handler/aws@ ~> 2.1.7",
    {
      "name": "asg-dns-handler",
      "source": "git::https://github.com/a0s/terraform-aws-asg-dns-handler.git"
    }
  ]
}

Its because i used two different versions of this module in the same time.
If i remove meltwater/asg-dns-handler/aws code generation starts working good again.
The question is why does this code interfere with each other, because in the end they are even in different folders.
Screenshot 2023-11-17 at 12 07 43

Copy link
Contributor

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 Feb 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants