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_spot_instance_request doesn't assign key or subnetID #2919

Closed
mrdavidlaing opened this issue Aug 3, 2015 · 3 comments
Closed

aws_spot_instance_request doesn't assign key or subnetID #2919

mrdavidlaing opened this issue Aug 3, 2015 · 3 comments

Comments

@mrdavidlaing
Copy link
Contributor

I'm attempting to launch a AWS spot instance into an existing VPC subnet using the following aws_spot_instance_request resource:

resource "aws_spot_instance_request" "workspace_instance" {
    ami = "ami-3fee3b54" #BOSH lite 9000.38
    instance_type = "m3.xlarge"
    spot_price = "0.15"

    subnet_id = "subnet-fcdXXXXX"
    key_name = "pcf"

A spot instance is created, but there are 2 important issues:

  1. It hasn't been assigned to the specified VPC subnet
  2. It hasn't been assigned a SSH key name (so I can't SSH into it)

Looking at the debug output, it appears that the subnetID and key_name settings are not being added to the AWS spot request API call:

2015/08/03 12:17:11 [DEBUG] apply: aws_spot_instance_request.workspace_instance: executing Apply
aws_spot_instance_request.workspace_instance: Creating...
  ami:                                       "" => "ami-3fee3b54"
2015/08/03 12:17:11 terraform-provider-aws: 2015/08/03 12:17:11 [DEBUG] Describing AMI "ami-3fee3b54" to get root block device name
  availability_zone:                         "" => "<computed>"
  ebs_block_device.#:                        "" => "<computed>"
  ephemeral_block_device.#:                  "" => "<computed>"
  instance_type:                             "" => "m3.xlarge"
  key_name:                                  "" => "pcf"
  placement_group:                           "" => "<computed>"
  private_dns:                               "" => "<computed>"
  private_ip:                                "" => "<computed>"
  public_dns:                                "" => "<computed>"
  public_ip:                                 "" => "<computed>"
  root_block_device.#:                       "" => "1"
  root_block_device.0.delete_on_termination: "" => "1"
  root_block_device.0.iops:                  "" => "<computed>"
  root_block_device.0.volume_size:           "" => "100"
  root_block_device.0.volume_type:           "" => "gp2"
  security_groups.#:                         "" => "<computed>"
  source_dest_check:                         "" => "1"
  spot_bid_status:                           "" => "<computed>"
  spot_instance_id:                          "" => "<computed>"
  spot_price:                                "" => "0.15"
  spot_request_state:                        "" => "<computed>"
  subnet_id:                                 "" => "subnet-fcdXXXXX"
  tags.#:                                    "" => "1"
  tags.Name:                                 "" => "workspace_instance"
  tenancy:                                   "" => "<computed>"
  vpc_security_group_ids.#:                  "" => "<computed>"
  wait_for_fulfillment:                      "" => "1"
2015/08/03 12:17:12 terraform-provider-aws: 2015/08/03 12:17:12 [DEBUG] Requesting spot bid opts: {
2015/08/03 12:17:12 terraform-provider-aws:   InstanceCount: 1,
2015/08/03 12:17:12 terraform-provider-aws:   LaunchSpecification: {
2015/08/03 12:17:12 terraform-provider-aws:     BlockDeviceMappings: [{
2015/08/03 12:17:12 terraform-provider-aws:         DeviceName: "/dev/sda1",
2015/08/03 12:17:12 terraform-provider-aws:         EBS: {
2015/08/03 12:17:12 terraform-provider-aws:           DeleteOnTermination: true,
2015/08/03 12:17:12 terraform-provider-aws:           VolumeSize: 100,
2015/08/03 12:17:12 terraform-provider-aws:           VolumeType: "gp2"
2015/08/03 12:17:12 terraform-provider-aws:         }
2015/08/03 12:17:12 terraform-provider-aws:       }],
2015/08/03 12:17:12 terraform-provider-aws:     EBSOptimized: false,
2015/08/03 12:17:12 terraform-provider-aws:     IAMInstanceProfile: {
2015/08/03 12:17:12 terraform-provider-aws:       Name: ""
2015/08/03 12:17:12 terraform-provider-aws:     },
2015/08/03 12:17:12 terraform-provider-aws:     ImageID: "ami-3fee3b54",
2015/08/03 12:17:12 terraform-provider-aws:     InstanceType: "m3.xlarge",
2015/08/03 12:17:12 terraform-provider-aws:     Monitoring: {
2015/08/03 12:17:12 terraform-provider-aws:       Enabled: false
2015/08/03 12:17:12 terraform-provider-aws:     },
2015/08/03 12:17:12 terraform-provider-aws:     Placement: {
2015/08/03 12:17:12 terraform-provider-aws:       AvailabilityZone: "",
2015/08/03 12:17:12 terraform-provider-aws:       GroupName: ""
2015/08/03 12:17:12 terraform-provider-aws:     },
2015/08/03 12:17:12 terraform-provider-aws:     UserData: ""
2015/08/03 12:17:12 terraform-provider-aws:   },
2015/08/03 12:17:12 terraform-provider-aws:   SpotPrice: "0.15",
2015/08/03 12:17:12 terraform-provider-aws:   Type: "persistent"
2015/08/03 12:17:12 terraform-provider-aws: }

Is this a bug?

@mrdavidlaing
Copy link
Contributor Author

This screenshot from the AWS control panel shows how a spot instance has been started successfully, but has not been assigned to the specified VPC subnet or given the specific key_name

screen shot 2015-08-03 at 12 31 13

catsby added a commit that referenced this issue Aug 31, 2015
…s_to_aws_spot_request

Pass key_name and subnetId to spot instance request - resolves issue #2919
@catsby
Copy link
Contributor

catsby commented Aug 31, 2015

I merged #2954, thanks for fixing it!

@catsby catsby closed this as completed Aug 31, 2015
@ghost
Copy link

ghost commented May 1, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants