Hi all, we are slowly in process of bring our IaC code up to date with more recent Pulumi releases. ...
g
Hi all, we are slowly in process of bring our IaC code up to date with more recent Pulumi releases. This might be a more TypeScript related question, but it's also closely ties to doing some AWS stuff. In particular, these two packages:
Copy code
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx/classic";
Which (at the moment), I am at (
package.json
):
Copy code
"@pulumi/aws": "^6.31.1",
        "@pulumi/awsx": "^1.0.6",
Prior to this I was pre-v1.x for
@pulumi/awsx
. These lines of code used to work:
Copy code
const vpc = aws.ec2.Vpc.get("default", outputs.vpcId);
  const vpcx = new awsx.ec2.Vpc("default", { vpc: vpc });
But now, I get this at build/deploy time:
Copy code
TSError: ⨯ Unable to compile TypeScript:
index.ts(90,46): error TS2739: Type 'Vpc' is missing the following properties from type 'Vpc': enableClassiclink, enableClassiclinkDnsSupport
I'm no TypeScript expert (and that's part of the problem!), but this is a codebase I inherited...
l
That's a pretty old version of awsx. Try ^2.0 (or even ^2.13).
g
Yes, I am aware that I am referencing an older version. One step at a time. I want to get it working with 1.xx.yy and then I can start dealing with issue(s) that are sure to come up as I work up to a more recent version.
l
The problem is that those properties used to exist in AWS and now don't. The old version of awsx that you're using is dependent on them, but the newer version of aws is not providing them. You either need to lock the old aws in, or update to a newer awsx. I recommend updating.
Since this is rarely-run code (compared to app code that might run thousands of times per day) the risk in updating is almost completely mitigated by the fact that you watch it run. Update the libraries, you probably won't have to update much of your code.
If you want to pin to the old aws version, try getting rid of the ^ in the version.
If that doesn't work, you'll have to browse the changelog or commit history to figure out when those properties were removed.
g
@little-cartoon-10569 I appreciate the comments, and I am fully aware of the fact that my versions can be pinned, etc. But, I have this inherited codebase, that I am trying to bring up-to-date step by step. As I said, I am no TS expert (more familiar with Python, but moving the whole project to Python is just not viable). Are you suggesting I downgrade the
@pulumi/aws
package until I find a version that works with the
1.x.y
version of
@pulumi/awsx
? I would be quite happy to update both the the latest, but I am trying to figure out what code changes I need to make with those VPC lines of code I referenced.
I find it interesting that I get no error indications in the IDE (WebStorm), but only at runtime.
l
I am suggesting that you upgrade everything all at once to latest. But given that you want to get it working the way it way, then yes, you need to downgrade something. The current version strings that you're using have a ^ prefix, which means that they have allowed upgrades, within a certain range. Apparently, one of them has upgraded to a version that is not compatible with the other. You need to upgrade or downgrade something.
f
+1 to upgrading. Perhaps think of it this way: AWS (to be clear: the cloud offering by Amazon) is an external dependency you have no control over. Things have changed, been added, been deprecated. Even if you could downgrade and get things "working", they could easily not work the way they had before you took ownership of the dependent codebase. For your specific example,
awsx
v2 - from the release notes - "VPC.EnableClassicLink was removed upstream because EC2 Classic is retired.". EC2 Classic is gone now.
👍 1