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

provider/aws: Fix AMI creation from snapshot issue #11842

Merged
merged 2 commits into from
Feb 10, 2017
Merged

Conversation

grubernaut
Copy link
Contributor

Previously the AMI creation accepted a static value for the AMI's block device's volume size.
This change allows the user to omit the volume_size attribute, in order to mimic the AWS API behavior, which will use the EBS Volume's size.

Also fixes a potential panic case when setting iops on the AMI's block device.

The aws_ami resource previously didn't have any acceptance tests, adds two acceptance tests and a full testing suite for the aws_ami resource, so further tests can be written, as well as expansion upon the other aws_ami_* acceptance tests

$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAMI_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/02/09 20:18:22 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAMI_ -timeout 120m
=== RUN   TestAccAWSAMI_basic
--- PASS: TestAccAWSAMI_basic (44.21s)
=== RUN   TestAccAWSAMI_snapshotSize
--- PASS: TestAccAWSAMI_snapshotSize (45.08s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    89.320s

Fixes: #11655

Previously the AMI creation accepted a static value for the AMI's block device's volume size.
This change allows the user to omit the `volume_size` attribute, in order to mimic the AWS API behavior, which will use the EBS Volume's size.

Also fixes a potential panic case when setting `iops` on the AMI's block device.

The `aws_ami` resource previously didn't have any acceptance tests, adds two acceptance tests and a full testing suite for the `aws_ami` resource, so further tests can be written, as well as expansion upon the other `aws_ami_*` acceptance tests

```
$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAMI_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/02/09 20:18:22 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAMI_ -timeout 120m
=== RUN   TestAccAWSAMI_basic
--- PASS: TestAccAWSAMI_basic (44.21s)
=== RUN   TestAccAWSAMI_snapshotSize
--- PASS: TestAccAWSAMI_snapshotSize (45.08s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    89.320s
```
Copy link
Contributor

@stack72 stack72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work - would rather the code on line 65 was deleted than commented out though. But that's just a nit pick!

@stack72 stack72 added the bug label Feb 10, 2017
@grubernaut grubernaut merged commit 5a467ed into master Feb 10, 2017
@grubernaut grubernaut deleted the f-update-aws-ami branch February 10, 2017 14:42
@CarltonHenderson
Copy link

Awesome @grubernaut. Thanks for fixing this - and even adding tests :-). This makes my life so much happier.

@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 this pull request may close these issues.

AMI can not be created from snapshot_id
3 participants