I tried out the learning tutorial: Build AWS Infrastructure with TypeScript | Terraform - HashiCorp Learn and got the following error:
[2022-01-05T16:42:30.186] [ERROR] default - TSError: ⨯ Unable to compile TypeScript:
main.ts(3,23): error TS2305: Module '"./.gen/providers/aws"' has no exported member 'Instance'.
at createTSError (/Users/jritsema/code/learn-cdktf-docker/node_modules/ts-node/src/index.ts:750:12)
at reportTSError (/Users/jritsema/code/learn-cdktf-docker/node_modules/ts-node/src/index.ts:754:19)
at getOutput (/Users/jritsema/code/learn-cdktf-docker/node_modules/ts-node/src/index.ts:941:36)
at Object.compile (/Users/jritsema/code/learn-cdktf-docker/node_modules/ts-node/src/index.ts:1243:30)
at Module.m._compile (/Users/jritsema/code/learn-cdktf-docker/node_modules/ts-node/src/index.ts:1370:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Object.require.extensions.<computed> [as .ts] (/Users/jritsema/code/learn-cdktf-docker/node_modules/ts-node/src/index.ts:1374:12)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
diagnosticText: `main.ts(3,23): error TS2305: Module '"./.gen/providers/aws"' has no exported member 'Instance'.\n`,
diagnosticCodes: [ 2305 ]
}
cdktf encountered an error while synthesizing
Synth command: npx ts-node main.ts
Error: non-zero exit code 1
I’m also getting this error in vs code…
Module '"./.gen/providers/aws"' has no exported member 'Instance'.ts(2305)
Here are the tool versions that I’m using:
terraform 1.1.2
nodejs 16.2.0
yarn 1.22.17
{
"dependencies": {
"@cdktf/provider-aws": "^4.0.1",
"@cdktf/provider-docker": "^0.5.145",
"cdktf": "^0.8.5",
"constructs": "^10.0.25"
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@types/node": "^17.0.8",
"jest": "^27.4.7",
"ts-jest": "^27.1.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
}
}