Trying to deploy to an AWS t4g instance using Type...
# aws
n
Trying to deploy to an AWS t4g instance using Typescript, but getting a typescript error in pulumi version = v2.14.0 that
node_modules/@pulumi/aws/types/enums/ec2/index.d.ts
does not have an enum value for "t4g.micro".
Copy code
Diagnostics:
  pulumi:pulumi:Stack (website-website):
    error: Running program '/home/user/code/pulumi/website' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    index.ts(222,3): error TS2322: Type '"t4g.micro"' is not assignable to type 'Input<"a1.2xlarge" | "a1.4xlarge" | "a1.large" | "a1.medium" | "a1.xlarge" | "c3.2xlarge" | "c3.4xlarge" | "c3.8xlarge" | "c3.large" | "c3.xlarge" | "c4.2xlarge" | "c4.4xlarge" | ... 154 more ... | "z1d.xlarge">'.

        at createTSError (/home/user/code/pulumi/website/node_modules/ts-node/src/index.ts:261:12)
        at getOutput (/home/user/code/pulumi/website/node_modules/ts-node/src/index.ts:367:40)
        at Object.compile (/home/user/code/pulumi/website/node_modules/ts-node/src/index.ts:558:11)
        at Module.m._compile (/home/user/code/pulumi/website/node_modules/ts-node/src/index.ts:439:43)
        at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
        at Object.require.extensions.<computed> [as .ts] (/home/user/code/pulumi/website/node_modules/ts-node/src/index.ts:442:12)
        at Module.load (internal/modules/cjs/loader.js:928:32)
        at Function.Module._load (internal/modules/cjs/loader.js:769:14)
        at Module.require (internal/modules/cjs/loader.js:952:19)
        at require (internal/modules/cjs/helpers.js:88:18)
I got around this before by hand editing the ts file in node_modules, but that seems like a bad approach (since I had to 
npm install
 again and it blew away my hacky changes). What's the better way to get around this?
Copy code
"devDependencies": {
        "@types/node": "^10.17.48"
    },
    "dependencies": {
        "@pulumi/aws": "^3.17.0",
        "@pulumi/awsx": "^0.22.0",
        "@pulumi/pulumi": "^2.15.0",
        "@types/ssh2": "^0.5.39",
        "@types/uuid": "^3.4.4",
        "scp2": "^0.5.0",
        "ssh2": "^0.8.5",
        "uuid": "^3.4.0"
    }
b
@red-match-15116 is this the new enums work?
b
So you can pass a string and cast it as an enum
Right @red-match-15116 ?
r
Hi! Yeah this is caused by the enums work, but the instance type should accept any string along with the enum types. Let me look into this, but a workaround should be to use
"t4g.micro" as InstanceType
It looks like we lost the fallback to
"string"
somewhere along the way during the enums update, I’m adding a fix for it now. I also have an item on my list to go through and add all the instance types we’re missing.
b
@red-match-15116 there’s already an issue for me to add the missing ones - I have a list but was waiting till after reinvent
👍 1
n
Thank you!