pulumi-eks
pulumi-eks copied to clipboard
For `eks.NodeGroupLaunchTemplate.version`, type 'number' is not assignable to type 'string'
Hello!
- Vote on this issue by adding a 👍 reaction
- To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already)
Issue details
When creating a new managed node group, there's a property named launchTemplate used to specific a specific EC2 launch template. eks.NodeGroupLaunchTemplate.version is of type Input<string> accepts "$Latest" (Ok).
However, eks.NodeGroupLaunchTemplate.version is not able to access aws.ec2.LaunchTemplate.(defaultVersion|latestVersion) as recommended in the documentation because the ec2 launch properties mentioned are of type pulumi.OutputInstance<number>. Yet, our documentation recommends using these properties rather than the string equivalent.
This works
launchTemplate: {
id: launchTemplate.id,
version: '$Latest'
}
This doesn't work
launchTemplate: {
id: launchTemplate.id,
version: launchTemplate.latestVersion
}
Steps to reproduce
- Use https://github.com/pulumi/pulumi-eks/tree/master/examples/managed-nodegroups as a starting point
- Add a new launch template
const launchTemplate = new aws.ec2.LaunchTemplate("my-launch-template", {
tags: {testTag: "tag value"},
});
- Observe in vscode the syntax linting for the code provided in the issue detail.
Expected: launchTemplate.version is able to access aws.ec2.LaunchTemplate.latestVersion and aws.ec2.LaunchTemplate.defaultVersion
Actual: Error ts2322 type 'number' is not assignable to type 'string' is shown in the IDE.
latestVersion is an Output, so you need to interpolate it:
version: pulumi.interpolate`${launchTemplate.latestVersion}`
This works for me in assorted implementations.
More context:
- https://www.pulumi.com/registry/packages/aws/api-docs/ec2/launchtemplate/#outputs
- https://www.pulumi.com/docs/intro/concepts/inputs-outputs/#outputs-and-strings
There are some notes somewhere somewhere around here that recommend not using '$Latest' because the AWS API will this as 1 and parse it as drift every time, causing Pulumi to smoosh-replace it.