Skip to content

Commit c388574

Browse files
authored
Fix plan for google_identity_platform_config always showing a change for phone_number.enabled=false and email.enabled=false (#12255)
1 parent f954b7c commit c388574

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

mmv1/products/identityplatform/Config.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ examples:
7171
- 'client.0.api_key'
7272
- 'client.0.firebase_subdomain'
7373
exclude_docs: true
74+
- name: 'identity_platform_config_with_false_values'
75+
primary_resource_id: 'default'
76+
vars:
77+
project_id: 'my-project-2'
78+
test_env_vars:
79+
org_id: 'ORG_ID'
80+
billing_acct: 'BILLING_ACCT'
81+
ignore_read_extra:
82+
- 'client.0.api_key'
83+
- 'client.0.firebase_subdomain'
84+
exclude_docs: true
7485
parameters:
7586
properties:
7687
- name: 'name'
@@ -92,6 +103,7 @@ properties:
92103
type: NestedObject
93104
description: |
94105
Configuration options related to authenticating a user by their email address.
106+
custom_flatten: 'templates/terraform/custom_flatten/identity_platform_config_email.go.tmpl'
95107
properties:
96108
- name: 'enabled'
97109
type: Boolean
@@ -108,6 +120,7 @@ properties:
108120
type: NestedObject
109121
description: |
110122
Configuration options related to authenticated a user by their phone number.
123+
custom_flatten: 'templates/terraform/custom_flatten/identity_platform_config_phone_number.go.tmpl'
111124
properties:
112125
- name: 'enabled'
113126
type: Boolean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
2+
transformed := make(map[string]interface{})
3+
4+
if v == nil {
5+
transformed["enabled"] = false
6+
} else {
7+
original := v.(map[string]interface{})
8+
9+
if original["enabled"] == nil {
10+
transformed["enabled"] = false
11+
} else {
12+
transformed["enabled"] = original["enabled"]
13+
}
14+
15+
if original["passwordRequired"] != nil {
16+
transformed["password_required"] = original["passwordRequired"]
17+
}
18+
}
19+
20+
return []interface{}{transformed}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
2+
transformed := make(map[string]interface{})
3+
4+
if v == nil {
5+
transformed["enabled"] = false
6+
} else {
7+
original := v.(map[string]interface{})
8+
9+
if original["enabled"] == nil {
10+
transformed["enabled"] = false
11+
} else {
12+
transformed["enabled"] = original["enabled"]
13+
}
14+
15+
if original["testPhoneNumbers"] != nil {
16+
transformed["test_phone_numbers"] = original["testPhoneNumbers"]
17+
}
18+
}
19+
20+
return []interface{}{transformed}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
resource "google_project" "default" {
2+
project_id = "{{index $.Vars "project_id"}}"
3+
name = "{{index $.Vars "project_id"}}"
4+
org_id = "{{index $.TestEnvVars "org_id"}}"
5+
billing_account = "{{index $.TestEnvVars "billing_acct"}}"
6+
deletion_policy = "DELETE"
7+
labels = {
8+
firebase = "enabled"
9+
}
10+
}
11+
12+
resource "google_project_service" "identitytoolkit" {
13+
project = google_project.default.project_id
14+
service = "identitytoolkit.googleapis.com"
15+
}
16+
17+
resource "google_identity_platform_config" "default" {
18+
project = google_project.default.project_id
19+
autodelete_anonymous_users = false
20+
sign_in {
21+
22+
anonymous {
23+
enabled = false
24+
}
25+
email {
26+
enabled = false
27+
}
28+
phone_number {
29+
enabled = false
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)