-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move sign_in from google_identity_platform_project_default_config to …
…google_identity_platform_config. (#8559) Co-authored-by: Shuya Ma <[email protected]>
- Loading branch information
1 parent
b8279d9
commit 110956f
Showing
7 changed files
with
266 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
mmv1/templates/terraform/custom_flatten/identity_platform_config_anonymous.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { | ||
if v == nil { | ||
return nil | ||
} | ||
|
||
original := v.(map[string]interface{}) | ||
transformed := make(map[string]interface{}) | ||
|
||
if original["enabled"] == nil { | ||
transformed["enabled"] = false | ||
} else { | ||
transformed["enabled"] = original["enabled"] | ||
} | ||
|
||
return []interface{}{transformed} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...terraform/resource_definition/identity_platform_project_default_config_deprecation.go.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<%# The license inside this block applies to this file. | ||
# Copyright 2023 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
-%> | ||
DeprecationMessage: "Deprecated. Use the `google_identity_platform_config` resource instead. " + | ||
"It contains a more comprehensive list of fields, and was created before " + | ||
"`google_identity_platform_project_default_config` was added.", |
127 changes: 127 additions & 0 deletions
127
...third_party/terraform/services/identityplatform/resource_identity_platform_config_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
package identityplatform_test | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
"github.com/hashicorp/terraform-provider-google/google/envvar" | ||
) | ||
|
||
func TestAccIdentityPlatformConfig_update(t *testing.T) { | ||
acctest.SkipIfVcr(t) | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"org_id": envvar.GetTestOrgFromEnv(t), | ||
"billing_acct": envvar.GetTestBillingAccountFromEnv(t), | ||
"quota_start_time": time.Now().AddDate(0, 0, 1).Format(time.RFC3339), | ||
"random_suffix": acctest.RandString(t, 10), | ||
} | ||
|
||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccIdentityPlatformConfig_basic(context), | ||
}, | ||
{ | ||
ResourceName: "google_identity_platform_config.basic", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccIdentityPlatformConfig_update(context), | ||
}, | ||
{ | ||
ResourceName: "google_identity_platform_config.basic", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccIdentityPlatformConfig_basic(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_project" "basic" { | ||
project_id = "tf-test-my-project%{random_suffix}" | ||
name = "tf-test-my-project%{random_suffix}" | ||
org_id = "%{org_id}" | ||
billing_account = "%{billing_acct}" | ||
labels = { | ||
firebase = "enabled" | ||
} | ||
} | ||
resource "google_project_service" "identitytoolkit" { | ||
project = google_project.basic.project_id | ||
service = "identitytoolkit.googleapis.com" | ||
} | ||
resource "google_identity_platform_config" "basic" { | ||
project = google_project.basic.project_id | ||
autodelete_anonymous_users = true | ||
sign_in { | ||
allow_duplicate_emails = true | ||
anonymous { | ||
enabled = true | ||
} | ||
email { | ||
enabled = true | ||
password_required = false | ||
} | ||
phone_number { | ||
enabled = true | ||
test_phone_numbers = { | ||
"+11231231234" = "000000" | ||
} | ||
} | ||
} | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccIdentityPlatformConfig_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_project" "basic" { | ||
project_id = "tf-test-my-project%{random_suffix}" | ||
name = "tf-test-my-project%{random_suffix}" | ||
org_id = "%{org_id}" | ||
billing_account = "%{billing_acct}" | ||
labels = { | ||
firebase = "enabled" | ||
} | ||
} | ||
resource "google_project_service" "identitytoolkit" { | ||
project = google_project.basic.project_id | ||
service = "identitytoolkit.googleapis.com" | ||
} | ||
resource "google_identity_platform_config" "basic" { | ||
project = google_project.basic.project_id | ||
sign_in { | ||
allow_duplicate_emails = false | ||
anonymous { | ||
enabled = false | ||
} | ||
email { | ||
enabled = true | ||
password_required = true | ||
} | ||
phone_number { | ||
enabled = true | ||
test_phone_numbers = { | ||
"+17651212343" = "111111" | ||
} | ||
} | ||
} | ||
} | ||
`, context) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters