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.

Provider generation doesn't work with v0.0.5

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 v0.0.5
  • cdktf-cli v0.0.5

Affected Resource(s)

TerraformProvider?

cdktf.json

{
  "language": "typescript",
  "app": "node main.js",
  "terraformProviders": ["aws@~> 2.0"]
}

main.ts

import { Construct } from 'constructs';
import { App, TerraformStack } from 'cdktf';
import { Instance } from './.gen/providers/aws';

class MyStack extends TerraformStack {
  constructor(scope: Construct, name: string) {
    super(scope, name);

    new Instance(this, 'Hello', {
      ami: "ami-2757f631",
      instanceType: "t2.micro"
    });

  }
}

const app = new App();
new MyStack(app, 'terraform-cdk-example');
app.synth();

Expected Behavior

After running yarn compile and cdktf synth, we should see the following in the terraformcdkexample.tf.json file in cdktf.out folder.

{
  "terraform": {
    "required_providers": {
      "aws": "~> 2.0"
    }
  },
  "resource": {
    "aws_instance": {
      "terraformcdkexampleHello8B822F74": {
        "ami": "ami-2757f631",
        "instance_type": "t2.micro"
      }
    }
  }
}

Actual Behavior

terraformcdkexample.tf.json

{
  "resource": {
    "aws_instance": {
      "terraformcdkexampleHello8B822F74": {
        "ami": "ami-2757f631",
        "instance_type": "t2.micro"
      }
    }
  }
}

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
joatmon08commented, May 14, 2020

I think this is a consequence of stabilizing provider generation. We moved this to the TerraformProvider implementation rather than within get. If we try to synthesize provider versioning on the stack level, I think we’re back to the problems we had before.

If our expected behavior is to generate a terraform block on cdktf get, then we will need to do a refactor to generate that at the top-level. I’m more inclined to make it a requirement to declare AwsProvider, etc. and document that it is required in the guides in order to render the top-level terraform block with required_provider.

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

v0.4.0 - Error: Provider produced inconsistent result after apply ...
We are facing this issue with Standard cluster where we get either 404 error or terraform root resource missing error. We started with...
Read more >
Configuration - Rocket Programming Guide
Rocket's configuration system is based on Figment's Provider s, types which provide ... environment variable starting at the current working directory.
Read more >
Draft Report - v0.0.5rm - 3GPP
Draft Report - v0.0.5rm. Source: Secretary TSG SA (Maurice Pope, MCC). Title: Draft Report of TSG SA meeting #24 - Draft version 0.0.5....
Read more >
Modeling Assumptions of the MVS - Multi-vector simulator
It stands for system planning and licensing costs. If you have optimized your energy system and see that an asset might not be...
Read more >
Dali Developer Documentation v0.5 - Eclipsepedia
1 Dali JPA Tools 0.5 – Internal/External Developer Documentation ... Validation in the form of “Problems” are reported based on the state of...
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