best-nest-62071
08/24/2021, 6:43 PMAssertionError: Unexpected type. Expected 'list' got '<class 'pulumi_aws.ec2._inputs.InstanceRootBlockDeviceArgs'>'
error: an unhandled error occurred: Program exited with non-zero exit code: 1
In pulumi I cant figure out how to convert the class to a list, Or even if I should be doing that. Im sure there's a pulumi way of doing this. Please point me in the right direction.
Code:
for i in range(5):
server = aws.ec2.Instance(f"webserver-{i:03}",
ami=ami.id,
iam_instance_profile='ec2_role',
instance_type=size,
key_name=sshKey,
root_block_device=[aws.ec2.InstanceRootBlockDeviceArgs(
device_name='/dev/sda1',
volume_size=100,
volume_type='gp3',
)],
subnet_id=['subnet-xxxxxxxxxxxxxxxx'],
tags={
"Name": f"webserver-{i:03}",
"Purpose": "webapp"
},
volume_tags={
"Name": f"webserver-{i:03}",
"Purpose": "webapp"
},
vpc_security_group_ids=[ secgrp.id ]
)
https://www.pulumi.com/docs/reference/pkg/aws/ec2/instance/#instancerootblockdeviceadorable-noon-15528
08/25/2021, 9:07 AMInstanceRootBlockDeviceArgs
but you are passing a list of a single InstanceRootBlockDeviceArgs
in the code you posted. The definition does not seem to expect a list:
root_block_device: Optional[pulumi.Input[pulumi.InputType['InstanceRootBlockDeviceArgs']]] = None,
best-nest-62071
08/25/2021, 9:18 PM