From db8805dfa5a4fdda107a2e05b34a10e2e1366261 Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Thu, 28 May 2015 11:25:13 -0500 Subject: [PATCH] provider/aws: Fix issue with restoring from snapshot ID Fixes #1862 --- builtin/providers/aws/resource_aws_instance.go | 5 ++++- website/source/docs/providers/aws/r/instance.html.markdown | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_instance.go b/builtin/providers/aws/resource_aws_instance.go index 6c41520c2..674aca709 100644 --- a/builtin/providers/aws/resource_aws_instance.go +++ b/builtin/providers/aws/resource_aws_instance.go @@ -433,13 +433,16 @@ func resourceAwsInstanceCreate(d *schema.ResourceData, meta interface{}) error { bd := v.(map[string]interface{}) ebs := &ec2.EBSBlockDevice{ DeleteOnTermination: aws.Boolean(bd["delete_on_termination"].(bool)), - Encrypted: aws.Boolean(bd["encrypted"].(bool)), } if v, ok := bd["snapshot_id"].(string); ok && v != "" { ebs.SnapshotID = aws.String(v) } + if v, ok := bd["encrypted"].(bool); ok && v { + ebs.Encrypted = aws.Boolean(v) + } + if v, ok := bd["volume_size"].(int); ok && v != 0 { ebs.VolumeSize = aws.Long(int64(v)) } diff --git a/website/source/docs/providers/aws/r/instance.html.markdown b/website/source/docs/providers/aws/r/instance.html.markdown index 080ccb871..5181c6bf3 100644 --- a/website/source/docs/providers/aws/r/instance.html.markdown +++ b/website/source/docs/providers/aws/r/instance.html.markdown @@ -95,7 +95,7 @@ Each `ebs_block_device` supports the following: on instance termination (Default: `true`). * `encrypted` - (Optional) Enables [EBS encryption](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) - on the volume (Default: `false`). + on the volume (Default: `false`). Cannot be used with `snapshot_id`. Modifying any `ebs_block_device` currently requires resource replacement.