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

WIP: Expose AMI's root volume size #2114

Closed

Conversation

tomelliff
Copy link
Contributor

Attempting to implement #1623

The idea is that an instance module should be able to default the root volume to the size of the AMI's root volume. Right now I have a couple of AMIs that have a considerably larger root volume (CUDA/NVidia drivers take a lot of space) and I'd ideally not have to remember to override the root volume size before an apply time failure due to the root volume size being defaulted to a smaller size than the AMI root volume size.

Right now the tests I've added are failing with the root_volume_size not being set at all.
I'll debug this when I get a chance but just want to push the work up for now.

The work here carries on from #1572

Attempting to implement hashicorp#1623
Right now the tests I've added are failing with the root_volume_size not being set at all.
I'll debug this when I get a chance but just want to push the work up for now.
@radeksimko radeksimko added the enhancement Requests to existing resources that expand the functionality or scope. label Oct 31, 2017
@tomelliff
Copy link
Contributor Author

Hmmm... not sure why the Travis build didn't fail last night. Those tests fail locally for me when I run them and building the provider and applying the following config doesn't output the root_volume_size into the state:

data "aws_ami" "selected" {
  most_recent = true

  filter {
    name   = "virtualization-type"
    values = ["hvm"]
  }

  filter {
    name   = "name"
    values = ["amzn-ami-vpc-nat*"]
  }

  owners = ["amazon"]
}
$ terraform state show aws_ami.selected
id                                                         = ami-38d20741
architecture                                               = x86_64
block_device_mappings.#                                    = 1
block_device_mappings.3607311014.device_name               = /dev/xvda
block_device_mappings.3607311014.ebs.%                     = 6
block_device_mappings.3607311014.ebs.delete_on_termination = true
block_device_mappings.3607311014.ebs.encrypted             = false
block_device_mappings.3607311014.ebs.iops                  = 0
block_device_mappings.3607311014.ebs.snapshot_id           = snap-0a9d1c80ae7d1f0ad
block_device_mappings.3607311014.ebs.volume_size           = 8
block_device_mappings.3607311014.ebs.volume_type           = standard
block_device_mappings.3607311014.no_device                 = 
block_device_mappings.3607311014.virtual_name              = 
creation_date                                              = 2017-10-01T09:12:53.000Z
description                                                = Amazon Linux AMI 2017.09.0.20170930 x86_64 VPC NAT HVM EBS
filter.#                                                   = 2
filter.3298344342.name                                     = name
filter.3298344342.values.#                                 = 1
filter.3298344342.values.0                                 = amzn-ami-vpc-nat*
filter.490168357.name                                      = virtualization-type
filter.490168357.values.#                                  = 1
filter.490168357.values.0                                  = hvm
hypervisor                                                 = xen
image_id                                                   = ami-38d20741
image_location                                             = amazon/amzn-ami-vpc-nat-hvm-2017.09.0.20170930-x86_64-ebs
image_owner_alias                                          = amazon
image_type                                                 = machine
most_recent                                                = true
name                                                       = amzn-ami-vpc-nat-hvm-2017.09.0.20170930-x86_64-ebs
owner_id                                                   = 137112412989
owners.#                                                   = 1
owners.0                                                   = amazon
product_codes.#                                            = 0
public                                                     = true
root_device_name                                           = /dev/xvda
root_device_type                                           = ebs
root_snapshot_id                                           = snap-0a9d1c80ae7d1f0ad
sriov_net_support                                          = simple
state                                                      = available
state_reason.%                                             = 2
state_reason.code                                          = UNSET
state_reason.message                                       = UNSET
tags.%                                                     = 0
virtualization_type                                        = hvm

Adding some debug logging to the data source shows it triggering the if condition at https://github.com/terraform-providers/terraform-provider-aws/pull/2114/files#diff-6c1ccb9926bf208fafaed38fa038b2b4R385 so not sure what I'm missing there.

I've got a fair bit on for a couple of days so will probably take a look at it again on Friday/the weekend but I'm confused in both why it's failing locally but also why Travis is passing.

@radeksimko radeksimko added the size/M Managed by automation to categorize the size of a PR. label Nov 15, 2017
@bflad bflad added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 28, 2018
@bflad
Copy link
Contributor

bflad commented Jan 28, 2018

@tomelliff is this still WIP?

@clangaxon
Copy link

Any update on this? It would be quite handy ...

@tomelliff
Copy link
Contributor Author

I'd completely forgotten about this to be honest.

I can take another look at it if it's useful for others still.

@bflad
Copy link
Contributor

bflad commented Jun 28, 2018

Closing due to WIP and lack of activity. If you feel like picking it back up, we can certainly reopen this 👍

@bflad bflad closed this Jun 28, 2018
@ghost
Copy link

ghost commented Apr 4, 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 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants