Skip to content

Commit

Permalink
make the location field required in google_storage_bucket (#5352) (
Browse files Browse the repository at this point in the history
…#3771)

* make location required

* updated related tests

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Oct 25, 2021
1 parent fffcdc1 commit 6489fa8
Show file tree
Hide file tree
Showing 74 changed files with 431 additions and 229 deletions.
4 changes: 4 additions & 0 deletions .changelog/5352.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:breaking-change
storage: changed the `location` field to `Required` in `google_storage_bucket ` resource

```
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func TestAccDataSourceGoogleCloudFunctionsFunction_basic(t *testing.T) {
func testAccDataSourceGoogleCloudFunctionsFunctionConfig(functionName, bucketName, zipFilePath string) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "bucket" {
name = "%s"
name = "%s"
location = "US"
}
resource "google_storage_bucket_object" "archive" {
Expand Down
3 changes: 2 additions & 1 deletion google-beta/data_source_google_storage_bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ func TestAccDataSourceGoogleStorageBucket_basic(t *testing.T) {
func testAccDataSourceGoogleStorageBucketConfig(bucketName string) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "foo" {
name = "%s"
name = "%s"
location = "US"
}
data "google_storage_bucket" "bar" {
Expand Down
10 changes: 5 additions & 5 deletions google-beta/data_source_storage_bucket_object_content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ func testAccDataSourceStorageBucketObjectContent_Basic(content, bucket string) s
return fmt.Sprintf(`
data "google_storage_bucket_object_content" "default" {
bucket = google_storage_bucket.contenttest.name
name = google_storage_bucket_object.object.name
name = google_storage_bucket_object.object.name
}
resource "google_storage_bucket_object" "object" {
name = "butterfly01"
name = "butterfly01"
content = "%s"
bucket = google_storage_bucket.contenttest.name
bucket = google_storage_bucket.contenttest.name
}
resource "google_storage_bucket" "contenttest" {
name = "%s"
location = "US"
name = "%s"
location = "US"
force_destroy = true
}`, content, bucket)
}
3 changes: 2 additions & 1 deletion google-beta/data_source_storage_object_signed_url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ data "google_storage_object_signed_url" "blerg" {
func testAccTestGoogleStorageObjectSignedURL(bucketName string) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "bucket" {
name = "%s"
name = "%s"
location = "US"
}
resource "google_storage_bucket_object" "story" {
Expand Down
15 changes: 10 additions & 5 deletions google-beta/iam_cloudfunctions_function_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ func TestAccCloudFunctionsCloudFunctionIamPolicyGenerated(t *testing.T) {
func testAccCloudFunctionsCloudFunctionIamMember_basicGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "archive" {
Expand Down Expand Up @@ -157,7 +158,8 @@ resource "google_cloudfunctions_function_iam_member" "foo" {
func testAccCloudFunctionsCloudFunctionIamPolicy_basicGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "archive" {
Expand Down Expand Up @@ -198,7 +200,8 @@ resource "google_cloudfunctions_function_iam_policy" "foo" {
func testAccCloudFunctionsCloudFunctionIamPolicy_emptyBinding(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "archive" {
Expand Down Expand Up @@ -235,7 +238,8 @@ resource "google_cloudfunctions_function_iam_policy" "foo" {
func testAccCloudFunctionsCloudFunctionIamBinding_basicGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "archive" {
Expand Down Expand Up @@ -270,7 +274,8 @@ resource "google_cloudfunctions_function_iam_binding" "foo" {
func testAccCloudFunctionsCloudFunctionIamBinding_updateGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
name = "tf-test-cloudfunctions-function-example-bucket%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "archive" {
Expand Down
50 changes: 30 additions & 20 deletions google-beta/iam_iap_app_engine_service_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -394,8 +395,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -464,8 +466,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -530,8 +533,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -594,8 +598,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -658,8 +663,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -727,8 +733,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -804,8 +811,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -873,8 +881,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -950,8 +959,9 @@ resource "google_app_engine_application" "app" {
}
resource "google_storage_bucket" "bucket" {
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
project = google_app_engine_application.app.project
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down
30 changes: 20 additions & 10 deletions google-beta/iam_iap_app_engine_version_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ func TestAccIapAppEngineVersionIamPolicyGenerated_withCondition(t *testing.T) {
func testAccIapAppEngineVersionIamMember_basicGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -317,7 +318,8 @@ resource "google_iap_app_engine_version_iam_member" "foo" {
func testAccIapAppEngineVersionIamPolicy_basicGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -364,7 +366,8 @@ resource "google_iap_app_engine_version_iam_policy" "foo" {
func testAccIapAppEngineVersionIamPolicy_emptyBinding(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -407,7 +410,8 @@ resource "google_iap_app_engine_version_iam_policy" "foo" {
func testAccIapAppEngineVersionIamBinding_basicGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -448,7 +452,8 @@ resource "google_iap_app_engine_version_iam_binding" "foo" {
func testAccIapAppEngineVersionIamBinding_updateGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -489,7 +494,8 @@ resource "google_iap_app_engine_version_iam_binding" "foo" {
func testAccIapAppEngineVersionIamBinding_withConditionGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -535,7 +541,8 @@ resource "google_iap_app_engine_version_iam_binding" "foo" {
func testAccIapAppEngineVersionIamBinding_withAndWithoutConditionGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -590,7 +597,8 @@ resource "google_iap_app_engine_version_iam_binding" "foo2" {
func testAccIapAppEngineVersionIamMember_withConditionGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -636,7 +644,8 @@ resource "google_iap_app_engine_version_iam_member" "foo" {
func testAccIapAppEngineVersionIamMember_withAndWithoutConditionGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down Expand Up @@ -691,7 +700,8 @@ resource "google_iap_app_engine_version_iam_member" "foo2" {
func testAccIapAppEngineVersionIamPolicy_withConditionGenerated(context map[string]interface{}) string {
return Nprintf(`
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content-%{random_suffix}"
name = "appengine-static-content-%{random_suffix}"
location = "US"
}
resource "google_storage_bucket_object" "object" {
Expand Down
Loading

0 comments on commit 6489fa8

Please sign in to comment.