question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cdktf synth not able to generate a proper cdk.tf.json

See original GitHub issue

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 version : 0.0.14 Language: Typescript Node Version : v14.8.0

Affected Resource(s)

The cdk.tf.json file wasn’t getting formed properly

Debug Output

Expected Behavior

A .json file with no errors

Actual Behavior

{
  "//": {
    "metadata": {
      "version": "0.0.14",
      "stackName": "terraform-aws"
    }
  },
  "terraform": {
    "required_providers": {
      "aws": {
        "version": "~> 2.0",
        "source": "aws"
      }
    }
  },
  "provider": {
    "aws": [
      {
        "region": "*****"
      }
    ]
  },
  "resource": {
    "aws_ecr_repository": {
      "terraformaws_service_8BA057A4": {
        "name": "service",
        "//": {
          "metadata": {
            "path": "terraform-aws/service",
            "uniqueId": "terraformaws_elementlayoutservice_8BA057A4",
            "stackTrace": [
              "new TerraformElement (C:\\Projects\\terraform-aws\\node_modules\\cdktf\\lib\\terraform-element.js:11:28)",
              "new TerraformResource (C:\\Projects\\terraform-aws\\node_modules\\cdktf\\lib\\terraform-resource.js:9:9)",
              "new EcrRepository (C:\\Projects\\terraform-aws\\.gen\\providers\\aws\\ecr-repository.js:13:9)",
              "new MyStack (C:\\Projects\\terraform-aws\\main.js:15:9)",
              "Object.<anonymous> (C:\\Projects\\terraform-aws\\main.js:36:5)",
              "Module._compile (internal/modules/cjs/loader.js:1251:30)",
              "Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10)",
              "Module.load (internal/modules/cjs/loader.js:1100:32)",
              "Function.Module._load (internal/modules/cjs/loader.js:962:14)",
              "Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)",
              "internal/main/run_main_module.js:17:47"
            ]
          }
        }
      }
    },
    "aws_ecs_task_definition": {
      "terraformaws_testelementlayoutservice_5DAA2FDD": {
        "container_definitions": "************",
        "cpu": "512",
        "family": "service-td",
        "memory": "1024",
        "requires_compatibilities": [
          "FARGATE"
        ],
        "task_role_arn": "****",
        "//": {
          "metadata": {
            "path": "terraform-aws/test-service",
            "uniqueId": "terraformaws_testservice_5DAA2FDD",
            "stackTrace": [
              "new TerraformElement (C:\\Projects\\terraform-aws\\node_modules\\cdktf\\lib\\terraform-element.js:11:28)",
              "new TerraformResource (C:\\Projects\\terraform-aws\\node_modules\\cdktf\\lib\\terraform-resource.js:9:9)",
              "new EcsTaskDefinition (C:\\Projects\\terraform-aws\\.gen\\providers\\aws\\ecs-task-definition.js:13:9)",
              "new MyStack (C:\\Projects\\terraform-aws\\main.js:24:9)",
              "Object.<anonymous> (C:\\Projects\\terraform-aws\\main.js:36:5)",
              "Module._compile (internal/modules/cjs/loader.js:1251:30)",
              "Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10)",
              "Module.load (internal/modules/cjs/loader.js:1100:32)",
              "Function.Module._load (internal/modules/cjs/loader.js:962:14)",
              "Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)",
              "internal/main/run_main_module.js:17:47"
            ]
          }
        }
      }
    }
  }
}

Steps to Reproduce

Ran cdktf synth

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
skorfmanncommented, Aug 25, 2020

@MelvitaAndrade Please reopen with more context if the issue still exists. In the best case, a dedicated repository where we can easily reproduce the issue.

0reactions
github-actions[bot]commented, Dec 7, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy Applications with CDK for Terraform
This is Terraform configuration in JSON format that CDKTF generated based on your TypeScript code in main.ts . Deploy your app. The cdktf...
Read more >
CDK for Terraform (CDKTF) on AWS: How to Configure an S3 ...
json file is used by the cdktf command to determine the project configuration. Follow the below steps to initialize the first CDKTF project ......
Read more >
Tutorial - Learn how to use AWS CDK for Terraform - nClouds
Run the cdktf synth command: Next, you'll begin rendering the code into Terraform and generating the code. Your output will be in full...
Read more >
Creating Kubernetes Cluster on Azure with Terraform and ...
This means that it is possible to produce JSON files in proper format and ... there will be a file named “cdk.tf.json” in...
Read more >
Deploy Infrastructure using CDK for Terraform with Go
Then you need to run cdktf get , which will dynamically generate the go packages for the providers in cdktf.json . You will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found