-
Notifications
You must be signed in to change notification settings - Fork 458
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
Error: Failed to query available provider packages #465
Comments
With this version of the 'main.ts' file, the deploy command works fine. I've also respond to the feedback comment on the hashicorp web site that it should be in sync with the actual repo! |
When I'm removing the line 26
in this example it reproduce the error. |
I'm not certain if implicit providers used to work and they broke or if there is just an error with that tutorial. @skorfmann Do you know the intended functionality? |
With the terraform v0.12, the I guess there are mistake in the tutorial since it is written that it works with the terraform version 0.12 and UP. In the generated file, cdk.out/cdk.tf.json, by the cdk does not include the We may follow these steps from a repo that I used to test the above. |
@lVlario0O0o thanks for clarifying. |
This comment has been minimized.
This comment has been minimized.
EDIT: I realized that the emit problem I was having was related to improper initialization of the provider I was using, and not to the code generation, sorry for the pings. You can reference a provider, generate the code, and then use objects within the provider and everything will build and synth, but will not deploy because the provider initialization ( PR #285 appears to be structured to fix this issue, and implies that this docker provider with the hierarchical path should function properly (specifically this commit). Here is the file that was introduced to split the provider name and emit these hierarchical providers. @skorfmann since you worked on this PR, perhaps you can weigh in if we are not using this correctly or if this is some kind of regression? Will help however I can, as this is a blocker for our cdktf POC (we can work around it by adding the required providers manually, but will need this to function properly for the POC so we do not have to edit the |
@lVlario0O0o Thanks for the detailed bug report! As @jsteinich said, we'll fix that in the tutorial.
Implicit providers used to work and should still work, when they are under the hashicorp namespace as far as I remember.
Could you elaborate on what you mean? Other than that, everything works for you - is that correct? |
Yes, I'm good now for my issue, but I'll try to explain what I mean in more detail and why I was confused. // cdktf.json
{
"language": "typescript",
"app": "npm run --silent compile && node main.js",
"terraformProviders": ["terraform-providers/docker@~> 2.0"],
"context": {
"excludeStackIdFromLogicalIds": "true",
"allowSepCharsInLogicalIds": "true"
}
} // main.ts
import { Construct } from "constructs";
import { App, TerraformStack } from "cdktf";
import { Container } from "./.gen/providers/docker";
class MyStack extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
new Container(this, "my-container", {
image: "ubuntu",
name: "ubuntu-test",
});
}
}
const app = new App();
new MyStack(app, "cdktf-test-docker");
app.synth(); This has no build issues and runs through synth and creates a full output file set, but it is not
This makes one assume that the problem is related to namespacing of providers but it's really not. I assumed that this was an issue with the required providers property not being included in the output for third party providers since it happened to the docker provider as well as the one I was originally testing with, but the issue was actually that I didn't create an instance of the provider within the context. I feel like this file should not have been "synthed" because it is not runnable. In my mind, Here is the {
"//": {
"metadata": {
"version": "0.0.19-pre.155",
"stackName": "cdktf-test-docker"
}
},
"resource": {
"docker_container": {
"my-container": {
"image": "ubuntu",
"name": "ubuntu-test",
"//": {
"metadata": {
"path": "cdktf-test-docker/my-container",
"uniqueId": "my-container",
"stackTrace": [
"...omitted..."
]
}
}
}
}
}
} |
Ahh, I see. So far synth isn't doing any validation whatsoever, it's all delegated to the Terraform CLI. However, I can see the value of doing a few basic checks like this. @lukep-coxauto would you mind creating a new issue for this? |
I looked it up again - Providers need to explicitly define their source location since Terraform 0.13. We do this by explicitly creating a provider object in the stack. This wasn't necessary before, but it was totally valid to do so anyway. Submitted a PR to the Learn guide. Thanks again for the bug report and the follow up issue 👍 |
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. |
Community Note
cdktf & Language Versions
Affected Resource(s)
Not able to deploy with the following command:
Debug Output
https://gist.github.com/lVlario0O0o/b0d528d646319052326ada38cb510f6d
Expected Behavior
https://gist.github.com/lVlario0O0o/a494f055443cfef0d042e1b6f23f5071
Actual Behavior
see the Debug Output
Steps to Reproduce
Follow the tutorial for the terraform cdk at the following link
Important Factoids
nothing atypical about my account
References
No other issues that i did not found.
The text was updated successfully, but these errors were encountered: