[2022-09-21T00:31:38.341] [ERROR] default - main.go:8:5: no required module provides package cdk.tf/go/stack/generated/kreuzwerker/docker; to add it:
ERROR: cdktf encountered an error while synthesizing
Synth command: go run main.go
Error: non-zero exit code 1
Command output on stderr:
main.go:8:5: no required module provides package cdk.tf/go/stack/generated/kreuzwerker/docker; to add it:
go get cdk.tf/go/stack/generated/kreuzwerker/docker
then tried to install kreuzwerker/docker package:
go: unrecognized import path "cdk.tf/go/stack/generated/kreuzwerker/docker": reading https://cdk.tf/go/stack/generated/kreuzwerker/docker?go-get=1: 404 Not Found
server response: The page could not be found
Just to make sure: Did you run cdktf get to generate the bindings (that are going to go into the generated directory?
What is your module name (at the top in the go.mod file)?
So I added kreuzwerker/docker to cdktf.json manually and then run cdktf get:
Generated go constructs in the output directory: generated
The generated code depends on jsii-runtime-go. If you haven't yet installed it, you can run go mod tidy to automatically
install it.
Then cdktf deploy:
⠹ Synthesizing
[2022-09-21T22:28:10.559] [ERROR] default - main.go:8:5: package cdk.tf/go/stack/generated/kreuzwerker/docker imports github.com/aws/jsii-runtime-go/runtime from implicitly required module; to add missing requirements, run:
go get github.com/aws/jsii-runtime-go@v1.67.0
generated/kreuzwerker/docker/docker_Config.go:5:2: package cdk.tf/go/stack/generated/kreuzwerker/docker/jsii imports github.com/aws/jsii-runtime-go/runtime from implicitly required module; to add missing requirements, run:
ERROR: cdktf encountered an error while synthesizing
Synth command: go run main.go
Error: non-zero exit code 1
Command output on stderr:
main.go:8:5: package cdk.tf/go/stack/generated/kreuzwerker/docker imports github.com/aws/jsii-runtime-go/runtime from implicitly required module; to add missing requirements, run:
go get github.com/aws/jsii-runtime-go@v1.67.0
generated/kreuzwerker/docker/docker_Config.go:5:2: package cdk.tf/go/stack/generated/kreuzwerker/docker/jsii imports github.com/aws/jsii-runtime-go/runtime from implicitly required module; to add missing requirements, run:
go get github.com/aws/jsii-runtime-go@v1.67.0
so then I launched go mod tidy and then finally fixed cdktf deploy:
learn-cdktf-docker Initializing the backend...
learn-cdktf-docker
Successfully configured the backend "local"! Terraform will automatically
use this backend unless the backend configuration changes.
learn-cdktf-docker Initializing provider plugins...
learn-cdktf-docker - Finding kreuzwerker/docker versions matching "2.22.0"...
learn-cdktf-docker - Using kreuzwerker/docker v2.22.0 from the shared cache directory
learn-cdktf-docker Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
learn-cdktf-docker Terraform has been successfully initialized!
...
Thanks for guiding. Go guide possible needs to have missing steps such as adding provider name to cdktf.json, running cdktf get, compiling by go mod ...