Skip to content

Commit dff3580

Browse files
Mark oidc and aws fields as Forcenew (#4290) (#2764)
Signed-off-by: Modular Magician <[email protected]>
1 parent 1fab48a commit dff3580

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

.changelog/4290.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
3+
```

google-beta/resource_iam_beta_workload_identity_pool_provider.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ For OIDC providers, the following rules apply:
179179
"aws": {
180180
Type: schema.TypeList,
181181
Optional: true,
182+
ForceNew: true,
182183
Description: `An Amazon Web Services identity provider. Not compatible with the property oidc.`,
183184
MaxItems: 1,
184185
Elem: &schema.Resource{
@@ -211,6 +212,7 @@ However, existing tokens still grant access.`,
211212
"oidc": {
212213
Type: schema.TypeList,
213214
Optional: true,
215+
ForceNew: true,
214216
Description: `An OpenId Connect 1.0 identity provider. Not compatible with the property aws.`,
215217
MaxItems: 1,
216218
Elem: &schema.Resource{
@@ -490,18 +492,6 @@ func resourceIAMBetaWorkloadIdentityPoolProviderUpdate(d *schema.ResourceData, m
490492
} else if v, ok := d.GetOkExists("attribute_condition"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, attributeConditionProp)) {
491493
obj["attributeCondition"] = attributeConditionProp
492494
}
493-
awsProp, err := expandIAMBetaWorkloadIdentityPoolProviderAws(d.Get("aws"), d, config)
494-
if err != nil {
495-
return err
496-
} else if v, ok := d.GetOkExists("aws"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, awsProp)) {
497-
obj["aws"] = awsProp
498-
}
499-
oidcProp, err := expandIAMBetaWorkloadIdentityPoolProviderOidc(d.Get("oidc"), d, config)
500-
if err != nil {
501-
return err
502-
} else if v, ok := d.GetOkExists("oidc"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, oidcProp)) {
503-
obj["oidc"] = oidcProp
504-
}
505495

506496
url, err := replaceVars(d, config, "{{IAMBetaBasePath}}projects/{{project}}/locations/global/workloadIdentityPools/{{workload_identity_pool_id}}/providers/{{workload_identity_pool_provider_id}}")
507497
if err != nil {
@@ -530,14 +520,6 @@ func resourceIAMBetaWorkloadIdentityPoolProviderUpdate(d *schema.ResourceData, m
530520
if d.HasChange("attribute_condition") {
531521
updateMask = append(updateMask, "attributeCondition")
532522
}
533-
534-
if d.HasChange("aws") {
535-
updateMask = append(updateMask, "aws")
536-
}
537-
538-
if d.HasChange("oidc") {
539-
updateMask = append(updateMask, "oidc")
540-
}
541523
// updateMask is a URL parameter but not present in the schema, so replaceVars
542524
// won't set it
543525
url, err = addQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")})

google-beta/resource_iam_beta_workload_identity_pool_provider_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ resource "google_iam_workload_identity_pool_provider" "my_provider" {
169169
workload_identity_pool_id = google_iam_workload_identity_pool.my_pool.workload_identity_pool_id
170170
workload_identity_pool_provider_id = "my-provider-%{random_suffix}"
171171
aws {
172-
account_id = "888888888888"
172+
account_id = "999999999999"
173173
}
174174
}
175175
`, context)
@@ -188,7 +188,8 @@ resource "google_iam_workload_identity_pool_provider" "my_provider" {
188188
"google.subject" = "assertion.sub"
189189
}
190190
oidc {
191-
issuer_uri = "https://sts.windows.net/azure-tenant-id-basic"
191+
allowed_audiences = ["https://example.com/gcp-oidc-federation", "example.com/gcp-oidc-federation"]
192+
issuer_uri = "https://sts.windows.net/azure-tenant-id-full"
192193
}
193194
}
194195
`, context)

0 commit comments

Comments
 (0)