diff --git a/aws/resource_aws_s3_bucket_policy.go b/aws/resource_aws_s3_bucket_policy.go index 593d144fbd7..b7f7fed8f43 100644 --- a/aws/resource_aws_s3_bucket_policy.go +++ b/aws/resource_aws_s3_bucket_policy.go @@ -42,8 +42,6 @@ func resourceAwsS3BucketPolicyPut(d *schema.ResourceData, meta interface{}) erro bucket := d.Get("bucket").(string) policy := d.Get("policy").(string) - d.SetId(bucket) - log.Printf("[DEBUG] S3 bucket: %s, put policy: %s", bucket, policy) params := &s3.PutBucketPolicyInput{ @@ -67,6 +65,8 @@ func resourceAwsS3BucketPolicyPut(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error putting S3 policy: %s", err) } + d.SetId(bucket) + return nil }