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

aws_launch_template with instance_market_options block causes ASG to error #5455

Closed
Jamie-BitFlight opened this issue Aug 5, 2018 · 4 comments · Fixed by #5957
Closed

aws_launch_template with instance_market_options block causes ASG to error #5455

Jamie-BitFlight opened this issue Aug 5, 2018 · 4 comments · Fixed by #5957
Labels
bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation.
Milestone

Comments

@Jamie-BitFlight
Copy link

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 "me too" comments, 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.11.7
Provider aws version 1.30

Affected Resource(s)

aws_launch_template

when aws_launch_template includes

  instance_market_options {
    market_type = "spot"
    spot_options {
      spot_instance_type = "one-time"
    }
  }

This error is given:

* aws_autoscaling_group.default: 1 error(s) occurred:

* aws_autoscaling_group.default: Error creating AutoScaling Group: InvalidQueryParameter: Incompatible launch template: Auto Scaling only supports the 'one-time' Spot instance type with no duration.
        status code: 400, request id: b5c28b73-98ad-11e8-a1ce-e58004ec386d
@catsby catsby added bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. labels Aug 6, 2018
@catsby
Copy link
Contributor

catsby commented Aug 6, 2018

Hey! Thanks for writing in. I've verified this, unfortunately I can't find any documentation on AWS's documentation site that mentions it 😦

I think at this time we simply need to document it on both https://www.terraform.io/docs/providers/aws/r/autoscaling_group.html and https://www.terraform.io/docs/providers/aws/r/launch_template.html#market-options . Adding a note on both pages to mention the limitation may be the best we can do for now.

Here's a full config that reproduces this, for those curious.:

resource "aws_launch_template" "foo" {
  name = "cts"

  block_device_mappings {
    device_name = "test"
  }

  credit_specification {
    cpu_credits = "standard"
  }

  disable_api_termination = true

  ebs_optimized = true

  elastic_gpu_specifications {
    type = "test"
  }

  iam_instance_profile {
    name = "test"
  }

  image_id = "ami-12a3b456"

  instance_initiated_shutdown_behavior = "terminate"

  instance_market_options {
    market_type = "spot"

    spot_options {
      spot_instance_type = "one-time"
    }
  }

  instance_type = "t2.micro"

  kernel_id = "aki-a12bc3de"

  key_name = "test"

  monitoring {
    enabled = true
  }

  network_interfaces {
    network_interface_id = "eni-123456ab"
    security_groups      = ["sg-1a23bc45"]
  }

  placement {
    availability_zone = "us-west-2b"
  }

  ram_disk_id = "ari-a12bc3de"

  vpc_security_group_ids = ["sg-12a3b45c"]

  tag_specifications {
    resource_type = "instance"

    tags {
      Name = "test"
    }
  }
}

resource "aws_autoscaling_group" "bar" {
  availability_zones        = ["us-west-2a"]
  name                      = "foobar3-terraform-test"
  max_size                  = 1
  min_size                  = 1
  health_check_grace_period = 300
  health_check_type         = "ELB"
  desired_capacity          = 0
  force_delete              = true

  termination_policies = [
    "ClosestToNextInstanceHour",
    "OldestLaunchConfiguration",
    "OldestInstance",
    "NewestInstance",
  ]

  launch_template = {
    id      = "${aws_launch_template.foo.id}"
    version = "$$Latest"
  }
}

@bflad
Copy link
Contributor

bflad commented Sep 24, 2018

The fix for this has been merged into master and will release with version 1.38.0 of the AWS provider, likely middle of this week.

@bflad
Copy link
Contributor

bflad commented Sep 26, 2018

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

@ghost
Copy link

ghost commented Apr 3, 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 Apr 3, 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. documentation Introduces or discusses updates to documentation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants