Merge pull request #1197 from hashicorp/b-fix-user-data-encoding

provider/aws: Fix encoding bug with AWS Instance
This commit is contained in:
Clint 2015-03-13 11:06:13 -05:00
commit c30cb09c80
2 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package aws
import ( import (
"bytes" "bytes"
"crypto/sha1" "crypto/sha1"
"encoding/base64"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"log" "log"
@ -258,7 +259,7 @@ func resourceAwsInstanceCreate(d *schema.ResourceData, meta interface{}) error {
// Figure out user data // Figure out user data
userData := "" userData := ""
if v := d.Get("user_data"); v != nil { if v := d.Get("user_data"); v != nil {
userData = v.(string) userData = base64.StdEncoding.EncodeToString([]byte(v.(string)))
} }
placement := &ec2.Placement{ placement := &ec2.Placement{

View File

@ -392,7 +392,7 @@ resource "aws_instance" "foo" {
instance_type = "m1.small" instance_type = "m1.small"
security_groups = ["${aws_security_group.tf_test_foo.name}"] security_groups = ["${aws_security_group.tf_test_foo.name}"]
user_data = "foo" user_data = "foo:-with-character's"
} }
` `