redhat-developer / mapt

Multi Architecture Provisioning Tool
Apache License 2.0
9 stars 7 forks source link

pick those aws availability zones where requested machine type is offered #233

Open anjannath opened 3 months ago

anjannath commented 3 months ago

Currently when AWS_DEFAULT_ZONE is set a random availability zone is picked, but it might happen that the AZ doesn't offer the requested machine time, in those scenarios mapt fails with the following error:

+  pulumi:pulumi:Stack mapt-windows-stackWindowsBaremetal-mapt-windows creating (109s) error: update failed\n +  pulumi:pulumi:Stack mapt-windows-stackWindowsBaremetal-mapt-windows **creating failed** 1 error\nDiagnostics:\n  pulumi:pulumi:Stack (mapt-windows-stackWindowsBaremetal-mapt-windows):\n    error: update failed\n\n  aws:ec2:Eip (eip-publicmain-awd-net0):\n    warning: urn:pulumi:stackWindowsBaremetal-mapt-windows::mapt-windows::aws:ec2/eip:Eip::eip-publicmain-awd-net0 verification warning: use domain attribute instead\n\n  aws:ec2:Instance (main-awd-instance):\n    error: 1 error occurred:\n    \t* creating EC2 Instance: Unsupported: Your requested instance type (c5d.metal Windows) is not supported in your requested Availability Zone (us-east-1f). Please retry your request by not specifying an Availability Zone or choosing us-east-1a, us-east-1b, us-east-1c, us-east-1d.\n    \tstatus code: 400, request id: 7641e2b9-9917-403f-8ad7-ccf7e410e21f\n\nResources:\n    + 13 created\n\nDuration: 1m52s\n\n\nstderr: \n","time":"2024-06-21T13:25:49+05:30"}

https://github.com/redhat-developer/mapt/blob/main/pkg/provider/aws/action/windows/windows.go#L97