From 31ffdea96ba3d5ddf5d42f862e68c1c133e49925 Mon Sep 17 00:00:00 2001 From: Michael Austin Date: Wed, 13 May 2015 16:01:52 -0400 Subject: [PATCH] add name for use with resouce id --- builtin/providers/aws/resource_aws_s3_bucket_policy.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builtin/providers/aws/resource_aws_s3_bucket_policy.go b/builtin/providers/aws/resource_aws_s3_bucket_policy.go index 7f8ea0404ab0..71131583ad68 100644 --- a/builtin/providers/aws/resource_aws_s3_bucket_policy.go +++ b/builtin/providers/aws/resource_aws_s3_bucket_policy.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "github.com/hashicorp/terraform/helper/schema" "github.com/awslabs/aws-sdk-go/aws" @@ -26,6 +27,10 @@ func resourceAwsS3BucketPolicy() *schema.Resource { Type: schema.TypeString, Required: true, }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + }, }, } } @@ -35,6 +40,7 @@ func resourceAwsS3BucketPolicyPut(d *schema.ResourceData, meta interface{}) erro s3conn := meta.(*AWSClient).s3conn bucket := d.Get("bucket").(string) policy := d.Get("policy").(string) + name := d.Get("name").(string) resp, err := s3conn.PutBucketPolicy( &s3.PutBucketPolicyInput{ @@ -48,6 +54,7 @@ func resourceAwsS3BucketPolicyPut(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error adding policy to S3 bucket: %s", err) } + d.SetId(fmt.Sprintf("%s:%s", bucket, )) return nil }