I have a launch template being created and updated...
# aws
s
I have a launch template being created and updated by
pulumi
but I found that the
default
launch template version was not being changed. I'm not sure how to use the
updateDefaultVersion
LaunchTemplate resource property listed here
<https://www.pulumi.com/docs/reference/pkg/aws/ec2/launchtemplate/#updatedefaultversion_nodejs>
. I can't seem to get this property in my code correctly. It doesn't go in
LaunchTemplateArgs
and I can't seem to assign a boolean to it as if it's a property. What am I doing wrong?
b
@salmon-ghost-86211 can you open an issue for this? I can repro it and it seems to be missing from the schema, in the pulumi-aws repo would be good
s
Thanks @billowy-army-68599. Issue #1077 created.
b
@salmon-ghost-86211 it seems I couldn't repro this because I had an old version of the plugin in the state file which i used to test. If you ensure you're on the latest version of the provider and run a
pulumi up
before trying to add the property, it should fix it
s
@billowy-army-68599 Both my IDE and
pulumi up
show the following error
Copy code
Object literal may only specify known properties, and 'updateDefaultVersion' does not exist in type 'GroupArgs'.
My code is
Copy code
const myAutoscalingGroup = new aws.autoscaling.Group(
    `${namePrefix}-autoscaling-group`,
    {
        desiredCapacity: 1,
        enabledMetrics: [ "GroupInServiceInstances" ],
        healthCheckGracePeriod: 0,
        launchTemplate: {
            id: myLaunchTemplate.id,
            version: "$Latest",
        },
        maxSize: 1,
        minSize: 1,
        name: namePrefix,
        updateDefaultVersion: true,
        vpcZoneIdentifiers: availableSubnetIds,
    },
    { dependsOn: myLaunchTemplate }
);
Here are some version details if that helps
Copy code
$ pulumi version
v2.8.2

$ pulumi plugin ls
NAME        KIND      VERSION       SIZE    INSTALLED  LAST USED
aws         resource  2.13.0        228 MB  n/a        1 month ago
docker      resource  2.2.3         40 MB   n/a        1 month ago
kubernetes  resource  2.4.2         70 MB   n/a        4 hours ago
b
@salmon-ghost-86211 the
updateDefaultVersion
property is on the
aws.ec2.LaunchTemplate
resource, not the
aws.autoscaling.Group
s
@billowy-army-68599 Wow. Of course that makes sense. I moved that property to my LaunchTemplate, but now I'm getting a similar error
Copy code
Object literal may only specify known properties, and 'updateDefaultVersion' does not exist in type 'LaunchTemplateArgs'.
b
can you try update to
2.13.1
. You'll need to remove the property, update your
package.json
and run a pulumi up without the property
s
I followed those steps.
Copy code
NAME        KIND      VERSION       SIZE    INSTALLED  LAST USED
aws         resource  2.13.1        228 MB  n/a        4 minutes ago
I removed the property, ran
npm ci
, ran pulumi up, then added the property back and ran another pulumi up. Same error.
My
package.json
is updated as well
As a test I even set the entries in
package.json
to
latest
and ran
npm ci
@billowy-army-68599 Here's my launch template if that clarifies anything
Copy code
const myLaunchTemplate = new aws.ec2.LaunchTemplate(
    `${serverDetails.namePrefix}-launch-template`,
    {
        description: `Builds the ${serverDetails.namePrefix} server`,
        iamInstanceProfile: {
            arn: serverDetails.instanceProfileArn
        },
        imageId: serverDetails.amiId,
        instanceType: serverDetails.instanceType,
        keyName: generalDetails.sshKey,
        namePrefix: `${serverDetails.namePrefix}-`,
        tagSpecifications: [
            {
                resourceType: "instance",
                tags: { "Name": serverDetails.namePrefix }
            },
            {
                resourceType: "volume",
                tags: { "Name": serverDetails.namePrefix }
            },
        ],
        updateDefaultVersion: true,
        userData: userData,
        vpcSecurityGroupIds: [ pulumi.output(mySG).apply(sg => sg.id) ],
    },
    { dependsOn: mySG }
);
b
did you run pulumi up after you updated
npm ci
? without having the
updateDefaultVersion: true
parameter
s
Yes. And I allowed it to continue which it did successfully. Then I added the parameter back as in the code above and ran pulumi up once more.
b
so just to confirm, the IDE is throwing the error, but the
pulumi up
works with the property set?
s
No. Both give the same error.
b
i know you ran
npm ci
but can you try manually clearing the `node_modules`: this is definitely an SDK issue rather than a provider issue
s
@billowy-army-68599 Thank you so much for your patience on this. That seems to have worked. I'm sorry to bother you with client-side problems. I closed issue 1077. Thanks again.
b
my pleasure, glad you got this sorted and it's good knowledge for me as well!