Skip to content

Commit 6830922

Browse files
Add new resource IAM OAuth Client Credential for Workforce Identity Federation (#13231) (#3563)
[upstream:82ce831e049b7deaa65296fb2f4f00e32a8b94aa] Signed-off-by: Modular Magician <[email protected]>
1 parent 6dbe977 commit 6830922

File tree

3 files changed

+84
-3
lines changed

3 files changed

+84
-3
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/hashicorp/hcl/v2 v2.23.0
1212
github.com/hashicorp/terraform-json v0.24.0
1313
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0
14-
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20250306002703-43815aee4477
14+
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20250306173231-26eadd7baad5
1515
github.com/mitchellh/go-homedir v1.1.0 // indirect
1616
github.com/pkg/errors v0.9.1
1717
github.com/stretchr/testify v1.10.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0 h1:7/iejAPyCRBhqAg3jOx+4UcA
173173
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0/go.mod h1:TiQwXAjFrgBf5tg5rvBRz8/ubPULpU0HjSaVi5UoJf8=
174174
github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c=
175175
github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0=
176-
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20250306002703-43815aee4477 h1:3S+CpGHGA8kWsbY9ZUX3sgwtkmBcPX7cqhcjp2er8kY=
177-
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20250306002703-43815aee4477/go.mod h1:GhoUvoOwZI/L3mQ7pG4gyVNnKCOm2ssnWON8RQzK7GA=
176+
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20250306173231-26eadd7baad5 h1:sXw4JgFO+89T0eGxARolIVNrbfnjJerKs9IY6HisJPU=
177+
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20250306173231-26eadd7baad5/go.mod h1:GhoUvoOwZI/L3mQ7pG4gyVNnKCOm2ssnWON8RQzK7GA=
178178
github.com/hashicorp/terraform-registry-address v0.2.4 h1:JXu/zHB2Ymg/TGVCRu10XqNa4Sh2bWcqCNyKWjnCPJA=
179179
github.com/hashicorp/terraform-registry-address v0.2.4/go.mod h1:tUNYTVyCtU4OIGXXMDp7WNcJ+0W1B4nmstVDgHMjfAU=
180180
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This code is generated by Magic Modules using the following:
8+
//
9+
// Configuration: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/iamworkforcepool/OauthClientCredential.yaml
10+
// Template: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/tgc/resource_converter.go.tmpl
11+
//
12+
// DO NOT EDIT this file directly. Any changes made to this file will be
13+
// overwritten during the next generation cycle.
14+
//
15+
// ----------------------------------------------------------------------------
16+
17+
package iamworkforcepool
18+
19+
import (
20+
"reflect"
21+
22+
"github.com/GoogleCloudPlatform/terraform-google-conversion/v6/tfplan2cai/converters/google/resources/cai"
23+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
24+
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
25+
)
26+
27+
const IAMWorkforcePoolOauthClientCredentialAssetType string = "iam.googleapis.com/OauthClientCredential"
28+
29+
func ResourceConverterIAMWorkforcePoolOauthClientCredential() cai.ResourceConverter {
30+
return cai.ResourceConverter{
31+
AssetType: IAMWorkforcePoolOauthClientCredentialAssetType,
32+
Convert: GetIAMWorkforcePoolOauthClientCredentialCaiObject,
33+
}
34+
}
35+
36+
func GetIAMWorkforcePoolOauthClientCredentialCaiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) ([]cai.Asset, error) {
37+
name, err := cai.AssetName(d, config, "//iam.googleapis.com/projects/{{project}}/locations/{{location}}/oauthClients/{{oauthclient}}/credentials/{{oauth_client_credential_id}}")
38+
if err != nil {
39+
return []cai.Asset{}, err
40+
}
41+
if obj, err := GetIAMWorkforcePoolOauthClientCredentialApiObject(d, config); err == nil {
42+
return []cai.Asset{{
43+
Name: name,
44+
Type: IAMWorkforcePoolOauthClientCredentialAssetType,
45+
Resource: &cai.AssetResource{
46+
Version: "v1",
47+
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/iam/v1/rest",
48+
DiscoveryName: "OauthClientCredential",
49+
Data: obj,
50+
},
51+
}}, nil
52+
} else {
53+
return []cai.Asset{}, err
54+
}
55+
}
56+
57+
func GetIAMWorkforcePoolOauthClientCredentialApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) {
58+
obj := make(map[string]interface{})
59+
disabledProp, err := expandIAMWorkforcePoolOauthClientCredentialDisabled(d.Get("disabled"), d, config)
60+
if err != nil {
61+
return nil, err
62+
} else if v, ok := d.GetOkExists("disabled"); !tpgresource.IsEmptyValue(reflect.ValueOf(disabledProp)) && (ok || !reflect.DeepEqual(v, disabledProp)) {
63+
obj["disabled"] = disabledProp
64+
}
65+
displayNameProp, err := expandIAMWorkforcePoolOauthClientCredentialDisplayName(d.Get("display_name"), d, config)
66+
if err != nil {
67+
return nil, err
68+
} else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(displayNameProp)) && (ok || !reflect.DeepEqual(v, displayNameProp)) {
69+
obj["displayName"] = displayNameProp
70+
}
71+
72+
return obj, nil
73+
}
74+
75+
func expandIAMWorkforcePoolOauthClientCredentialDisabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
76+
return v, nil
77+
}
78+
79+
func expandIAMWorkforcePoolOauthClientCredentialDisplayName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
80+
return v, nil
81+
}

0 commit comments

Comments
 (0)