mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-05 17:52:38 +00:00
Added test for uppercasing google_storage_bucket locations.
This commit is contained in:
parent
1b14b27468
commit
74196a6b4f
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
@ -11,7 +12,6 @@ import (
|
||||||
|
|
||||||
"google.golang.org/api/googleapi"
|
"google.golang.org/api/googleapi"
|
||||||
"google.golang.org/api/storage/v1"
|
"google.golang.org/api/storage/v1"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceStorageBucket() *schema.Resource {
|
func resourceStorageBucket() *schema.Resource {
|
||||||
|
@ -42,8 +42,8 @@ func resourceStorageBucket() *schema.Resource {
|
||||||
Default: "US",
|
Default: "US",
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
StateFunc: func(l interface{}) string {
|
StateFunc: func(s interface{}) string {
|
||||||
return strings.ToUpper(l.(string))
|
return strings.ToUpper(s.(string))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
func TestAccStorageBucket_customAttributes(t *testing.T) {
|
||||||
var bucket storage.Bucket
|
var bucket storage.Bucket
|
||||||
bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt())
|
bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt())
|
||||||
|
@ -335,6 +355,15 @@ resource "google_storage_bucket" "bucket" {
|
||||||
`, bucketName)
|
`, 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 {
|
func testAccStorageBucket_customAttributes(bucketName string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_storage_bucket" "bucket" {
|
resource "google_storage_bucket" "bucket" {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user