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

Generate wrong comunity provider configuration #547

Closed
dzirg44 opened this issue Feb 4, 2021 · 6 comments · Fixed by #681
Closed

Generate wrong comunity provider configuration #547

dzirg44 opened this issue Feb 4, 2021 · 6 comments · Fixed by #681
Labels
bug Something isn't working cdktf-cli
Milestone

Comments

@dzirg44
Copy link

dzirg44 commented Feb 4, 2021

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

package.json

    "@types/node": "^14.14.25",
    "cdktf-cli": "0.1.0-pre.178",
    "typescript": "^4.1.3"

cdktf

0.0.19-pre.149

typescript

4.1.3

also tried stable version

Affected Resource(s)

  • cdktf get

Debug Output

a lot of errors, but just because of completely broken file.

Expected Behavior

generate working typescript configuration or show error\errors.

Actual Behavior

When I try to generate typescript provider from

{
  "language": "typescript",
  "terraformProviders": ["phillbaker/elasticsearch@~> 1.5.1"],
}

i can see , that index file cannot be properly created.

Steps to Reproduce

add terraform provider as described and check .gen/providers/elasticsearch/index.ts file.

@dzirg44 dzirg44 added the bug Something isn't working label Feb 4, 2021
@jsteinich
Copy link
Collaborator

@dzirg44 which version of Terraform do you have installed?
I experienced errors when using 0.12.x, but 0.13.x worked fine for me.

@dzirg44
Copy link
Author

dzirg44 commented Feb 5, 2021

Terraform v0.14.3

Your version of Terraform is out of date! The latest version
is 0.14.6. You can update by downloading from https://www.terraform.io/downloads.html

upgraded to the
v0.14.5 without any effect.

generated file (index.ts) looks like

export * from './elasticsearch-provider';

blic constructor(scope: Construct, id: string, config: IndexConfig) {
    super(scope, id, {
      terraformResourceType: 'elasticsearch_index',
      terraformGeneratorMetadata: {
        providerName: 'elasticsearch'
      },
      provider: config.provider,
      dependsOn: config.dependsOn,
      count: config.count,
      lifecycle: config.lifecycle
    });
    this._aliases = config.aliases;
    this._autoExpandReplicas = config.autoExpandReplicas;
    this._codec = config.codec;
    this._forceDestroy = config.forceDestroy;
    this._loadFixedBitsetFiltersEagerly = config.loadFixedBitsetFiltersEagerly;
    this._mappings = config.mappings;
    this._name = config.name;
    this._numberOfReplicas = config.numberOfReplicas;
    this._numberOfShards = config.numberOfShards;
    this._refreshInterval = config.refreshInterval;
    this._rolloverAlias = config.rolloverAlias;
    this._routingPartitionSize = config.routingPartitionSize;
  }

  // ==========
  // ATTRIBUTES
  // ==========

where as you can see we don't have class name, even constructor cannot be properly generated
I've also tried with different version of node, and different version of cdkf. Maybe I missed something, but I don't know what.

@skorfmann
Copy link
Contributor

where as you can see we don't have class name, even constructor cannot be properly generated
I've also tried with different version of node, and different version of cdkf. Maybe I missed something, but I don't know what.

The ES index resource overwrites the index.ts which usually does the export of all generated resources. See the aws example how this is supposed to look like.

In the case where a resource is called index, we'll have to make sure that we append something like resource to the file name.

@dzirg44
Copy link
Author

dzirg44 commented Feb 5, 2021

Ah, got it! Thank you! Anyway it would be nice if cdktf-cli could handle with it, or just show error. Something like 'this Provider contains index resource, and cannot be properly generated'

@skorfmann
Copy link
Contributor

Ah, got it! Thank you! Anyway it would be nice if cdktf-cli could handle with it, or just show error. Something like 'this Provider contains index resource, and cannot be properly generated'

Sorry, I should have been clearer. You're absolutely right, that's something we'll fix in cdktf.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 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 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working cdktf-cli
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants