@cdktf/provider-aws"' has no exported member named 'AwsProvider'

Hello All. I have been trying to follow the following tutorial to get an ec2 instance setup using terraform.

import { AwsProvider, ec2 } from “@cdktf/provider-aws”;

The aws Provider is underlined in red, and errors out when I try to list it stating that there is no exported member named AwsProvider. I have followed the tutorial completely and installed the provider correctly because it is showing up in my dependencies. I have also tried a different tutorial where I use the ./gen/ to get to it but the same error occurred. What could be the reason this is occuring?

Hi @WilmingtonDavid,

I think the tutorial you referred to here was written for earlier versions of CDK for Terraform. The structure of the provider proxy stub modules is different in CDK for Terraform v0.13 and later, as described in the CDK for Terraform v0.13 upgrade guide.

The AwsProvider symbol now belongs to @cdktf/provider-aws/lib/provider:

import { AwsProvider } from "@cdktf/provider-aws/lib/provider";

For EC2 you can now import types from their individual namespaces. For example, for an EC2 instance:

import { Instance } from "@cdktf/provider-aws/lib/instance";
1 Like

Thank you so much! I will give this a try