pulumi / pulumi-aws

An Amazon Web Services (AWS) Pulumi resource package, providing multi-language access to AWS
Apache License 2.0
430 stars 151 forks source link

SpotInstanceRequest doesn't respect availability_zone parameter #1834

Open akennedy4155 opened 2 years ago

akennedy4155 commented 2 years ago

Hello!

Issue details

SpotInstanceRequest always defaults to "us-east-1e", even though I'm specifying a different availability zone in the parameters. I need a different zone because my instance type isn't available in us-east-1e.

Steps to reproduce

game_server = ec2.SpotInstanceRequest(
    "Ec2_Instance_GameServer_",
    ami="ami-04505e74c0741db8d",
    iam_instance_profile=instance_profile.name,
    instance_interruption_behavior="stop",
    instance_type="m5zn.large",
    key_name="craft-mac-work",
    security_groups=["launch-wizard-2"],
    spot_type="persistent",
    wait_for_fulfillment=True,
    spot_price="0.05",
    availability_zone="us-east-1c",
    tags={"Name": "cheap-worker"}
)

Also doesn't work by specifying in LaunchTemplate...

launch_template = ec2.LaunchTemplate(
    "Ec2_LaunchTemplate_GameServerLaunchTemplate_",
    placement=ec2.LaunchTemplatePlacementArgs(
        availability_zone="us-east-1c"
    )
)

game_server = ec2.SpotInstanceRequest(
    "Ec2_Instance_GameServer_",
    ami="ami-04505e74c0741db8d",
    iam_instance_profile=instance_profile.name,
    instance_interruption_behavior="stop",
    instance_type="m5zn.large",
    key_name="craft-mac-work",
    security_groups=["launch-wizard-2"],
    spot_type="persistent",
    wait_for_fulfillment=True,
    launch_template=ec2.SpotInstanceRequestLaunchTemplateArgs(
        id=launch_template.id
    ),
    spot_price="0.05",
    tags={"Name": "cheap-worker"}
)

Expected: SpotInstanceProvider respects the availability_zone that I provide. Actual: us-east-1e is always chosen

akennedy4155 commented 2 years ago

Possibly related to https://github.com/hashicorp/terraform-provider-aws/issues/12680? Testing!

akennedy4155 commented 2 years ago

Confirmed! Damn... upstream....