Describe the bug
When mixed_instances_policy.spot_allocation_strategy is set to a non-lowest-price strategy such as price-capacity-optimized, Goployer
still sends SpotInstancePools: 0 to the AWS Auto Scaling API when spot_instance_pools is omitted from the manifest.
AWS rejects the request because SpotInstancePools is only valid with the lowest-price spot allocation strategy.
To Reproduce
Steps to reproduce the behavior:
- Configure a stack with mixed instances policy enabled.
- Set
spot_allocation_strategy to price-capacity-optimized.
- Omit
spot_instance_pools from the manifest.
- Deploy the stack.
- See AWS reject the Auto Scaling request because
SpotInstancePools is present with a non-lowest-price allocation strategy.
Example:
mixed_instances_policy:
enabled: true
spot_allocation_strategy: price-capacity-optimized
# spot_instance_pools omitted
Expected behavior
Goployer should omit SpotInstancePools from the AWS request unless spot_allocation_strategy is lowest-price and spot_instance_pools is greater
than zero.
Screenshots
N/A
Desktop (please complete the following information):
- OS: N/A
- Browser: N/A
- Version: N/A
Smartphone (please complete the following information):
- Device: N/A
- OS: N/A
- Browser: N/A
- Version: N/A
Additional context
Code-level cause:
pkg/aws/ec2.go always sets SpotInstancePools while building Auto Scaling InstancesDistribution:
SpotInstancePools: aws.Int32(int32(mixedInstancePolicy.SpotInstancePools)),
Because the config struct uses a plain integer, omitted YAML becomes Go's zero value 0. Since the AWS SDK field is a pointer, aws.Int32(0) means
the field is sent as 0, not omitted.
The builder validation only rejects non-lowest-price strategies when spot_instance_pools > 0, so it misses the omitted-value case that still
gets serialized into the AWS request.
Describe the bug
When
mixed_instances_policy.spot_allocation_strategyis set to a non-lowest-pricestrategy such asprice-capacity-optimized, Goployerstill sends
SpotInstancePools: 0to the AWS Auto Scaling API whenspot_instance_poolsis omitted from the manifest.AWS rejects the request because
SpotInstancePoolsis only valid with thelowest-pricespot allocation strategy.To Reproduce
Steps to reproduce the behavior:
spot_allocation_strategytoprice-capacity-optimized.spot_instance_poolsfrom the manifest.SpotInstancePoolsis present with a non-lowest-priceallocation strategy.Example: