Skip to content

Commit

Permalink
Merge pull request #3910 from hashicorp/phinze/s3-object-homedir-expand
Browse files Browse the repository at this point in the history
provider/aws: homedir expand in s3 object source
  • Loading branch information
radeksimko committed Nov 14, 2015
2 parents 432cab5 + 44f259b commit d5ae5ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion builtin/providers/aws/resource_aws_s3_bucket_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"

"github.com/hashicorp/terraform/helper/schema"
"github.com/mitchellh/go-homedir"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
Expand Down Expand Up @@ -95,7 +96,11 @@ func resourceAwsS3BucketObjectPut(d *schema.ResourceData, meta interface{}) erro

if v, ok := d.GetOk("source"); ok {
source := v.(string)
file, err := os.Open(source)
path, err := homedir.Expand(source)
if err != nil {
return fmt.Errorf("Error expanding homedir in source (%s): %s", source, err)
}
file, err := os.Open(path)
if err != nil {
return fmt.Errorf("Error opening S3 bucket object source (%s): %s", source, err)
}
Expand Down

0 comments on commit d5ae5ba

Please sign in to comment.