Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the SpotFleet capacity to 0 returns an error (bug in the AWS provider) #12757

Closed
shani-e opened this issue Apr 10, 2020 · 5 comments · Fixed by #12759
Closed

Changing the SpotFleet capacity to 0 returns an error (bug in the AWS provider) #12757

shani-e opened this issue Apr 10, 2020 · 5 comments · Fixed by #12759
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@shani-e
Copy link

shani-e commented Apr 10, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

0.12.24

Affected Resource(s)

  • aws_spot_fleet_request

Terraform Configuration Files

resource "aws_spot_fleet_request" "eks_spot_fleet" {
  iam_fleet_role                     = data.aws_iam_role.aws-ec2-spot-fleet-tagging-role.arn

  target_capacity                    = var.spotfleet_capacity
 
 replace_unhealthy_instances        = true
  excess_capacity_termination_policy = "Default"
  fleet_type                         = "maintain"
  allocation_strategy                = "diversified"
  valid_until                        = "2050-01-01T00:00:00Z"

  launch_specification {
    instance_type            = var.worker_instance_type
    ami                      = var.kuberenets_worker_image_id
    key_name                 = var.key_pair_name
    iam_instance_profile_arn = aws_iam_instance_profile.instance-profile.arn
    availability_zone        = data.aws_availability_zones.available.names[0]
    subnet_id                = aws_subnet.private-subnet_a.id
    vpc_security_group_ids   = [aws_security_group.worker-security-group.id]
    user_data                = base64encode(local.spotfleet-node-userdata)

    root_block_device {
      volume_size           = var.ebs_volume_size
      volume_type           = "gp2"
      delete_on_termination = true
    }

    tags = {
      "Name"                                      = "${var.cluster-name}-worker"
      "kubernetes.io/cluster/${var.cluster-name}" = "shared"
      "Cluster"                                   = var.cluster-name
      "SpotFleet"                                 = "true"
    }
  }
  }

Debug Output

https://gist.github.com/Shalgo/75e16468971ee065cdafcbf95ea2fbef

Expected Behavior

The capacity of the SpotFleet should be changed to 0 spots.

Actual Behavior

After changing the capacity to "0" in AWS provider 2.57.0 I got this error after applied:

Error: error updating spot request (sfr-5a212ca5-c970-4beb-895c-93281ccd527b): InvalidParameterCombinationException: No attributes specified.
status code: 400, request id: bc707986-d852-4e66-b190-ca640ce42dd0

In older version of AWS provider , The fleet's capacity can be changed to 0 without receiving an error, but in fact, the operation does not take effect at all.
The capacity remains as it was.

If I reduce the fleet capacity to a number greater than 0 it works.
But if I change the capacity to 0, it does not really change, and no error is received.
The capacity remains as it was.

Steps to Reproduce

  1. Specify the AWS provider to 2.57.0
  2. Create a configuration of maintain spot fleet with some capacity >0 (like my example)
  3. terraform apply
  4. Change the Capacity to "0"
  5. 'terraform apply'

Important Factoids

none

References

  • #0000
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Apr 10, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 10, 2020
@DrFaust92
Copy link
Collaborator

addressed in #12759

@shani-e
Copy link
Author

shani-e commented Apr 10, 2020

After rechecked, I see that in AWS provider versions lower than 257.0, The fleet's capacity can be changed to 0 without receiving an error, but in fact the operation does not take effect at all. The capacity will remain as it was.
If I reduce the fleet capacity to a number greater than 0 it works. But if I change the capacity to 0, it does not really change, and no error is received.

Please fix it so when the capacity changed to zero, it will work. Thanks.

@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 25, 2020
@anGie44 anGie44 added this to the v3.1.0 milestone Jul 31, 2020
@anGie44
Copy link
Contributor

anGie44 commented Jul 31, 2020

The bug fix has been merged and will release with the upcoming v3.1.0 of the Terraform AWS Provider.

@ghost
Copy link

ghost commented Aug 7, 2020

This has been released in version 3.1.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Aug 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants