Skip to content

Commit

Permalink
Merge branch 'master' into unlink-billing-account
Browse files Browse the repository at this point in the history
  • Loading branch information
ubschmidt2 committed Jun 17, 2017
2 parents 72aac20 + f1ffb9d commit 7659c0b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ IMPROVEMENTS:
BUG FIXES:

* Changed `google_compute_instance_group_manager` `target_size` default to 0 [GH-65]
* Represent GCS Bucket locations as uppercase in state. [GH-117]
* Allow unlinking of billing account [GH-133]
4 changes: 4 additions & 0 deletions google/resource_storage_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"log"
"strings"
"time"

"github.com/hashicorp/terraform/helper/resource"
Expand Down Expand Up @@ -41,6 +42,9 @@ func resourceStorageBucket() *schema.Resource {
Default: "US",
Optional: true,
ForceNew: true,
StateFunc: func(s interface{}) string {
return strings.ToUpper(s.(string))
},
},

"predefined_acl": &schema.Schema{
Expand Down
29 changes: 29 additions & 0 deletions google/resource_storage_bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ func TestAccStorageBucket_basic(t *testing.T) {
})
}

func TestAccStorageBucket_lowercaseLocation(t *testing.T) {
var bucket storage.Bucket
bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccStorageBucketDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccStorageBucket_lowercaseLocation(bucketName),
Check: resource.ComposeTestCheckFunc(
testAccCheckStorageBucketExists(
"google_storage_bucket.bucket", bucketName, &bucket),
),
},
},
})
}

func TestAccStorageBucket_customAttributes(t *testing.T) {
var bucket storage.Bucket
bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt())
Expand Down Expand Up @@ -335,6 +355,15 @@ resource "google_storage_bucket" "bucket" {
`, bucketName)
}

func testAccStorageBucket_lowercaseLocation(bucketName string) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "bucket" {
name = "%s"
location = "eu"
}
`, bucketName)
}

func testAccStorageBucket_customAttributes(bucketName string) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "bucket" {
Expand Down

0 comments on commit 7659c0b

Please sign in to comment.