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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert command throws error when count is present #889

Closed
scottenriquez opened this issue Aug 3, 2021 · 2 comments 路 Fixed by #1011
Closed

Convert command throws error when count is present #889

scottenriquez opened this issue Aug 3, 2021 · 2 comments 路 Fixed by #1011
Labels
bug Something isn't working confirmed independently reproduced by an engineer on the team feature/convert priority/important-soon High priority, to be worked on as part of our current release or the following one.

Comments

@scottenriquez
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

Terraform version: 1.0.3
CDK for Terraform version: 0.5

Debug Output

Link to Gist

Expected Behavior

Source Terraform:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

resource "aws_instance" "multiple_servers" {
  count = 4

  ami           = "ami-0c2b8ca1dad447f8a"
  instance_type = "t2.micro"

  tags = {
    Name = "Server ${count.index}"
  }
}

Command:

cat terraform.tf | cdktf convert --language typescript

Expected
One or more Instances to be generated.

new aws.Instance(this, "multiple_server", {
  ami: "ami-0c2b8ca1dad447f8a",
  instanceType: "t2.micro",
  tags: {
    name: "Server ${count.index}",
  },
});

Actual Behavior

Error: Internal Error: input.startsWith is not a function

Steps to Reproduce

  • Copy HCL above into a file named terraform.tf
  • Run cat terraform.tf | cdktf convert --language typescript
@scottenriquez scottenriquez added bug Something isn't working new Un-triaged issue labels Aug 3, 2021
@DanielMSchmidt DanielMSchmidt added confirmed independently reproduced by an engineer on the team feature/convert priority/important-soon High priority, to be worked on as part of our current release or the following one. and removed new Un-triaged issue labels Aug 3, 2021
@DanielMSchmidt
Copy link
Contributor

My guess for the root cause is that its in the extractReferencesFromExpression function.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 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 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working confirmed independently reproduced by an engineer on the team feature/convert priority/important-soon High priority, to be worked on as part of our current release or the following one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants