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

AMI can not be created from snapshot_id #11655

Closed
CarltonHenderson opened this issue Feb 3, 2017 · 1 comment · Fixed by #11842
Closed

AMI can not be created from snapshot_id #11655

CarltonHenderson opened this issue Feb 3, 2017 · 1 comment · Fixed by #11842

Comments

@CarltonHenderson
Copy link

Hi there,

Terraform Version

Terraform v0.8.5
Terraform v0.7.5
(the only two versions I tested)

Affected Resource(s)

Please list the resources as a list, for example:

  • aws_ami

Terraform Configuration Files

  resource "aws_ami" "{{ instance_name }}" {
    name = "{{ instance_name }}"
    virtualization_type = "hvm"
    root_device_name = "/dev/sda1"
    ebs_block_device {
      device_name = "/dev/sda1"
      snapshot_id = "{{ snapshot_id }}"
    }
  }

Debug Output

...
2017/02/03 03:22:37 [DEBUG] plugin: terraform: ---[ REQUEST POST-SIGN ]-----------------------------
2017/02/03 03:22:37 [DEBUG] plugin: terraform: POST / HTTP/1.1
2017/02/03 03:22:37 [DEBUG] plugin: terraform: Host: ec2.us-east-1.amazonaws.com
2017/02/03 03:22:37 [DEBUG] plugin: terraform: User-Agent: APN/1.0 HashiCorp/1.0 Terraform/0.8.5
2017/02/03 03:22:37 [DEBUG] plugin: terraform: Content-Length: 435
[redacted]
2017/02/03 03:22:37 [DEBUG] plugin: terraform: Content-Type: application/x-www-form-urlencoded; charset=utf-8
2017/02/03 03:22:37 [DEBUG] plugin: terraform: X-Amz-Date: 20170203T082237Z
2017/02/03 03:22:37 [DEBUG] plugin: terraform: Accept-Encoding: gzip
2017/02/03 03:22:37 [DEBUG] plugin: terraform: 
2017/02/03 03:22:37 [DEBUG] plugin: terraform: Action=RegisterImage&Architecture=x86_64&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true&BlockDeviceMapping.1.Ebs.SnapshotId=snap-[redacted]&BlockDeviceMapping.1.Ebs.VolumeSize=0&BlockDeviceMapping.1.Ebs.VolumeType=standard&Description=&ImageLocation=&Name=aws-management-bl-RESTORATION&RootDeviceName=%2Fdev%2Fsda1&SriovNetSupport=simple&Version=2016-11-15&VirtualizationType=hvm
2017/02/03 03:22:37 [DEBUG] plugin: terraform: -----------------------------------------------------
...
Error applying plan:

1 error(s) occurred:

2017/02/03 03:22:37 [DEBUG] plugin: waiting for all plugin processes to complete...
* aws_ami.aws-management-bl-RESTORATION: InvalidParameterValue: Value (0) for parameter volumeSize is invalid. The volume size is smaller than the snapshot size (20)
	status code: 400, request id: 30b9c2ea-394c-45cf-b61d-3df90cb2a11f

Expected Behavior

Terraform should make the AMI 20 GB like the snapshot I'm trying to make the AMI from. As stated in the manual: If snapshot_id is set and volume_size is omitted then the volume will have the same size as the selected snapshot.

Actual Behavior

Terraform tries to make a 0GB AMI and amazon complains.

Steps to Reproduce

  1. terraform plan -out plan && terraform apply plan

Workaround

Specify volume_size = 20 #GB or whatever size fits your snapshot.

@ghost
Copy link

ghost commented Apr 16, 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 Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants