provider/aws: Fix issue with restoring from snapshot ID

Fixes #1862
This commit is contained in:
Clint Shryock 2015-05-28 11:25:13 -05:00
parent 2ca4df03ae
commit db8805dfa5
2 changed files with 5 additions and 2 deletions

View File

@ -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))
}

View File

@ -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.