Terraform CDK With GO

Hello,

I’m exploring the terraform cdk to start adopt to my Projects. But im unable to run the cdktf get command. I’m Following the tutorial.

cdktf.json

{
    "language": "go",
    "app": "go run main.go",
    "codeMakerOutput": "generated",
    "projectId": "781328fa-9aba-4886-8095-59c51a2fa644",
    "terraformProviders": [
       "hashicorp/aws@~> 3.42"
   ],
    "context": {
        "excludeStackIdFromLogicalIds": "true",
"allowSepCharsInLogicalIds": "true"
    }
}

Im aware the documentation says the cdktf get command may take several minutes to complete, but for me is taking one hour without finish. Always with the same message:

 downloading and generating modules and providers...

Am i doing something wrong? How can i debug?

My Environment:

Terraform: v1.1.0 on linux_amd64
Go:  go1.17.2 linux/amd64
CDKTF: 0.8.2

Thanks for any help.

Regards,
Fábio Santos

Hi @fdmsantos!

You could try another provider (such as e.g. hashicorp/null@~> 3.1.0) and see if that finishes successfully. But that said – building the AWS provider for Go can take quite some time. Depending on the machine you are running it on something between 1 to 2 hours may certainly be possible.

Best!
Ansgar

Thanks @ansgarm for reply.

It works with null provider. I will wait two hours and then check.

But have to exist a workaround. I had a look in this project : GitHub - hashicorp/cdktf-provider-aws: Prebuilt Terraform CDK (cdktf) provider for aws.

But it seems this doesn’t support GO yet.

Regards,
Fábio Santos

Hi @fdmsantos!
Yes, that’s right. We’ve this issue tracking that: Publish pre-built providers for Go · Issue #723 · hashicorp/terraform-cdk · GitHub