Skip to content

Can't pass InstanceProfile to LaunchTemplate.iamInstanceProfile #1348

Open

Description

Problem

The TypeScript code below compiles correctly, and previews correctly, but fails during update.

Error

p-ts-aws-launchtemplate-iam % pulumi up -y --skip-preview
Updating (dev-clstokes)

View Live: https://app.pulumi.com/clstokes/p-ts-aws-launchtemplate-iam/dev-clstokes/updates/8

     Type                        Name                                      Status         Info
 +   pulumi:pulumi:Stack         p-ts-aws-launchtemplate-iam-dev-clstokes  created        
 +   ├─ aws:iam:InstanceProfile  main                                      created        
     └─ aws:ec2:LaunchTemplate   main                                      **failed**     1 error
 
Diagnostics:
  aws:ec2:LaunchTemplate (main):
    error: aws:ec2/launchTemplate:LaunchTemplate resource 'main' has a problem: Expected Object Type: Expected object, got string
 
Resources:
    + 2 created

Duration: 5s

Code to Reproduce

import * as aws from "@pulumi/aws";

const ubuntuAmiId = aws.getAmi({
    owners: ["099720109477"], // Ubuntu
    mostRecent: true,
    filters: [{ name: "name", values: ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"] },],
}).then(it => it.id);

const iamProfile = new aws.iam.InstanceProfile("main");

const lt = new aws.ec2.LaunchTemplate("main", {
    imageId: ubuntuAmiId,
    iamInstanceProfile: iamProfile, // no compile error, but update will fail
    // iamInstanceProfile: { arn: iamProfile.arn }, // update will complete successfully
});

Steps to reproduce

  1. pulumi new aws-typescript -y
  2. copy the code into index.ts
  3. `pulumi up -y --skip-preview

Versions

% pulumi version
v2.19.0
% npm ls
eks-cluster@1.0.0 /Users/clstokes/cc/scratch/p-ts-aws-launchtemplate-iam
├── @pulumi/aws@3.28.0
└── @pulumi/pulumi@2.20.0

Workaround

Set the iamInstanceProfile as below:

iamInstanceProfile: { arn: iamProfile.arn },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    customer/feedbackFeedback from customerskind/bugSome behavior is incorrect or out of spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions