Where can I find for Terraform CDK a API reference, where "ec2" or "vpc" are described?

Dear Experts,

I search a API reference guide similar to this one for AWS CDK. I only found this one, but I can’t see ec2 and vpc described.

I also have not found any basic examples like this one for AWS CDK. Where can I get all this important and basic informations?

@fdervisi I think you need to select the submodule (ec2 or vpc) to view the reference: Construct Hub

1 Like

terraform-cdk/examples at main · hashicorp/terraform-cdk · GitHub contains several examples. There is also CDK for Terraform | Terraform by HashiCorp which is where documentation is hosted.

1 Like

thanks @jsteinich . I found those basic examples I wonder if we have more? I search more advanced examples leveraging modules for example. For AWS CDK you have a lot of those, would be good to have an overview about Terraform CDK examples…

Having trouble finding the right API reference as well. There’s so many flavors and language bindings that getting relevant search hits is hard. The examples in the github repo are pretty basic.

Specifically I’m looking for Python CDKTF equivalent of LookupMachineImage — AWS Cloud Development Kit 1.170.0 documentation

AttributeError: module 'cdktf_cdktf_provider_aws.ec2' has no attribute 'LookupMachineImage'

the python cdktf_cdktf_provider_aws package doesn’t seem to contain the string LookupMachineImage at all and I cant seem to find API reference anywhere :frowning:

CDKTF Examples and Guides | Terraform by HashiCorp has a more complete list of examples; some of which are more complex.

LookupMachineImage is specific to the AWS CDK. You’ll want to use a data source to lookup that information instead. Terraform Registry is the Terraform documentation for such a data source.
I’m not aware of a current python example for using it; however, Use DataSources in the examples where possible · Issue #2071 · hashicorp/terraform-cdk · GitHub mentions wanting to add one.