https://pulumi.com logo
#aws
Title
# aws
s

salmon-ghost-86211

08/14/2020, 9:39 PM
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

billowy-army-68599

08/14/2020, 10:00 PM
@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

salmon-ghost-86211

08/14/2020, 10:09 PM
Thanks @billowy-army-68599. Issue #1077 created.
b

billowy-army-68599

08/17/2020, 4:11 PM
@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

salmon-ghost-86211

08/17/2020, 7:03 PM
@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

billowy-army-68599

08/17/2020, 7:11 PM
@salmon-ghost-86211 the
updateDefaultVersion
property is on the
aws.ec2.LaunchTemplate
resource, not the
aws.autoscaling.Group
s

salmon-ghost-86211

08/17/2020, 7:15 PM
@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

billowy-army-68599

08/17/2020, 7:17 PM
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

salmon-ghost-86211

08/17/2020, 7:26 PM
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

billowy-army-68599

08/17/2020, 7:43 PM
did you run pulumi up after you updated
npm ci
? without having the
updateDefaultVersion: true
parameter
s

salmon-ghost-86211

08/17/2020, 7:45 PM
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

billowy-army-68599

08/17/2020, 7:58 PM
so just to confirm, the IDE is throwing the error, but the
pulumi up
works with the property set?
s

salmon-ghost-86211

08/17/2020, 8:35 PM
No. Both give the same error.
b

billowy-army-68599

08/17/2020, 9:15 PM
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

salmon-ghost-86211

08/17/2020, 11:18 PM
@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

billowy-army-68599

08/17/2020, 11:19 PM
my pleasure, glad you got this sorted and it's good knowledge for me as well!