Open nikpivkin opened 6 months ago
I think you're running into a duplicate/combination of both #3188 and #2907.
There are two issues:
cdktf init --template="typescript" --providers="aws@~>4.0"
when it should be asking users to run the command cdktf init --template="typescript" --providers="aws"
(i.e. no version constraint). The issue is that there is no prebuilt provider available for the combination of CDKTF 0.20 and AWS 4.x, we only have a prebuilt package available for the combination of CDKTF 0.20 and AWS 5.x. Since it can't find a prebuilt provider, what it's actually doing is installing locally-built bindings, yet the rest of the tutorial assumes the prebuilt provider is installed, which causes conflicts. I've submitted a PR in the tutorials repo (HashiCorp internal only so I can't link to it here) and will get it shepherded through ASAP because you're not the first to get tripped up by this.import
statements, i.e.:import (
"github.com/cdktf/cdktf-provider-aws-go/aws/v10/instance"
awsprovider "github.com/cdktf/cdktf-provider-aws-go/aws/v10/provider"
)
The problem is that these version numbers get incremented relatively frequently, at minimum with every new feature release of CDKTF. The tutorials were written at the time when CDKTF was at v0.13 and the corresponding AWS prebuilt provider was at v10. Now CDKTF is at v0.20 and the corresponding AWS prebuilt provider is at v19, so the import statements should instead read:
import (
"github.com/cdktf/cdktf-provider-aws-go/aws/v19/instance"
awsprovider "github.com/cdktf/cdktf-provider-aws-go/aws/v19/provider"
)
Because the tutorials live in an entirely different repo managed by the Education team and not by us, we don't have any way to automate updating these when we do releases, unfortunately, which is why there's this regression.
In any case, I've also included updating these to v19 in my PR on the tutorial, which should address the issue for anyone trying the tutorial today, but I can't guarantee this problem won't reoccur in the future. For Go users, we may have no choice but to add a note of some kind to double-check the version numbers in the import statements because they may become outdated in the future.
@xiehan Thank you for such a detailed response!
I tried to initialise the project without specifying the aws provider version, but got an error:
cdktf init --template="go" --providers="aws" --local
...
[2024-01-18T21:23:33.016] [INFO] default - Checking whether pre-built provider exists for the following constraints:
provider: aws
version : latest
language: go
cdktf : 0.20.1
[2024-01-18T21:23:36.472] [INFO] default - Found pre-built provider.
Adding package github.com/cdktf/cdktf-provider-aws-go/aws @ 19.1.1
[2024-01-18T21:24:25.965] [ERROR] default - go: downloading github.com/cdktf/cdktf-provider-aws-go/aws/v19 v19.1.1
go: downloading github.com/cdktf/cdktf-provider-aws-go/aws/v19 v19.1.1
[2024-01-18T21:24:36.972] [ERROR] default - go: github.com/cdktf/cdktf-provider-aws-go/aws/v19@v19.1.1: create zip: module source tree too large (max size is 524288000 bytes)
go: github.com/cdktf/cdktf-provider-aws-go/aws/v19@v19.1.1: create zip: module source tree too large (max size is 524288000 bytes)
non-zero exit code 1
Error: non-zero exit code 1
at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:99:8179)
at Object.onceWrapper (node:events:634:26)
at ChildProcess.emit (node:events:519:28)
at ChildProcess.emit (node:domain:488:12)
at maybeClose (node:internal/child_process:1105:16)
at Socket.<anonymous> (node:internal/child_process:457:11)
at Socket.emit (node:events:519:28)
at Socket.emit (node:domain:488:12)
at Pipe.<anonymous> (node:net:337:12)
at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)
Collecting Debug Information...
/opt/homebrew/lib/node_modules/cdktf-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^
Error: non-zero exit code 1
at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:99:8179)
at Object.onceWrapper (node:events:634:26)
at ChildProcess.emit (node:events:519:28)
at ChildProcess.emit (node:domain:488:12)
at maybeClose (node:internal/child_process:1105:16)
at Socket.<anonymous> (node:internal/child_process:457:11)
at Socket.emit (node:events:519:28)
at Socket.emit (node:domain:488:12)
at Pipe.<anonymous> (node:net:337:12)
at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) {
stderr: 'go: downloading github.com/cdktf/cdktf-provider-aws-go/aws/v19 v19.1.1\n' +
'go: github.com/cdktf/cdktf-provider-aws-go/aws/v19@v19.1.1: create zip: module source tree too large (max size is 524288000 bytes)\n'
}
I found a related issue, but it's closed as solved.
It's closed as solved because it will be fixed the next time the AWS provider does a release, which will trigger a new release of our prebuilt provider for AWS. The AWS provider does weekly releases on Thursday nights, so a new version should be out and this should be resolved by tomorrow morning.
Hi @nikpivkin π There's a new release out now of the pre-built provider that fixes this. I just checked and was able to install the latest package locally π
Description
Running the
cdktf synth
command with the example from the documentation returns an error:Links
https://developer.hashicorp.com/terraform/tutorials/cdktf/cdktf-build?in=terraform%2Fcdktf&variants=cdk-language%3Ago
Help Wanted
Community Note