I'm trying to assign an instance profile I just cr...
# aws
s
I'm trying to assign an instance profile I just created to a Launch Template , but I get
Copy code
error: aws:ec2/launchTemplate:LaunchTemplate resource 'my-launch-template' has a problem: iam_instance_profile.0: expected object, got string
Here's my basic code snippet
Copy code
const myInstanceRole = new ServiceRole(
    `${pulumi.getStack()}-my-instanceRole`,
    {
        managedPolicyArns: [
            "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
            "arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"
        ],
        service: "<http://ec2.amazonaws.com|ec2.amazonaws.com>"
    }
).role;

const myInstanceProfile = new aws.iam.InstanceProfile(
    "my-instance-profile",
    { role: myInstanceRole }
);

const myLaunchTemplate = new aws.ec2.LaunchTemplate(
    `${namePrefix}-launch-template`,
    {
        description: `Builds the ${namePrefix} my server`,
        iamInstanceProfile: myInstanceProfile,
        imageId: amiId,
        instanceType: instanceType,
        keyName: sshKey,
        namePrefix: namePrefix,
        userData: userData,
        vpcSecurityGroupIds: availableSubnetIds,
    }
);
Any ideas?
b
hey @salmon-ghost-86211, I believe that parameter takes an object, like this
Copy code
iamInstanceProfile: {
        arn: instanceProfile.arn
}
s
Crikey! Totally missed that. Thank you @billowy-army-68599