Skip to content

Commit 7434d9f

Browse files
add recaptcha enterprise key resource (#5507) (#10672)
* add recaptcha enterprise key resource * add version beta to iosKey sample Signed-off-by: Modular Magician <[email protected]>
1 parent 9e1bfe0 commit 7434d9f

15 files changed

+1417
-1
lines changed

.changelog/5507.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_recaptcha_enterprise_key`
3+
```

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module github.com/hashicorp/terraform-provider-google
22
require (
33
cloud.google.com/go/bigtable v1.10.1
4-
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211117235310-d31aef517fa2
4+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811
55
github.com/apparentlymart/go-cidr v1.1.0
66
github.com/client9/misspell v0.3.4
77
github.com/davecgh/go-spew v1.1.1

go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -1440,3 +1440,7 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-202110
14401440
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211026195335-4a6ae4ac04de/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
14411441
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518 h1:tFdFasG+VDpnn+BfVbZrfGcoH6pw6s7ODYlZlhTO3UM=
14421442
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
1443+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211129235756-547215b5e6ef h1:f+09BJVg+I/SObjSguOGGoSQHlT/Y1c8ah+nz1bkppI=
1444+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211129235756-547215b5e6ef/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
1445+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811 h1:j1JJXw1MuANOPXJcruRaKIYIfPMNUwksphKSQruFF6w=
1446+
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=

google/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ type Config struct {
166166
EventarcBasePath string
167167
GkeHubBasePath string
168168
OrgPolicyBasePath string
169+
RecaptchaEnterpriseBasePath string
169170
// CloudBuild WorkerPool uses a different endpoint (v1beta1) than any other CloudBuild resources
170171
CloudBuildWorkerPoolBasePath string
171172
}

google/provider.go

+2
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ func Provider() *schema.Provider {
690690
GkeHubFeatureCustomEndpointEntryKey: GkeHubFeatureCustomEndpointEntry,
691691
OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
692692
PrivatecaCertificateTemplateEndpointEntryKey: PrivatecaCertificateTemplateCustomEndpointEntry,
693+
RecaptchaEnterpriseEndpointEntryKey: RecaptchaEnterpriseEndpointEntry,
693694

694695
CloudBuildWorkerPoolEndpointEntryKey: CloudBuildWorkerPoolEndpointEntry,
695696
},
@@ -1209,6 +1210,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
12091210
"google_eventarc_trigger": resourceEventarcTrigger(),
12101211
"google_org_policy_policy": resourceOrgPolicyPolicy(),
12111212
"google_privateca_certificate_template": resourcePrivatecaCertificateTemplate(),
1213+
"google_recaptcha_enterprise_key": resourceRecaptchaEnterpriseKey(),
12121214
},
12131215
// ------------------------------------
12141216
map[string]*schema.Resource{

google/provider_dcl_client_creation.go

+24
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc"
2828
orgpolicy "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/orgpolicy"
2929
privateca "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/privateca"
30+
recaptchaenterprise "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/recaptchaenterprise"
3031
)
3132

3233
func NewDCLAssuredWorkloadsClient(config *Config, userAgent, billingProject string, timeout time.Duration) *assuredworkloads.Client {
@@ -212,3 +213,26 @@ func NewDCLPrivatecaClient(config *Config, userAgent, billingProject string, tim
212213
dclConfig := dcl.NewConfig(configOptions...)
213214
return privateca.NewClient(dclConfig)
214215
}
216+
217+
func NewDCLRecaptchaEnterpriseClient(config *Config, userAgent, billingProject string, timeout time.Duration) *recaptchaenterprise.Client {
218+
configOptions := []dcl.ConfigOption{
219+
dcl.WithHTTPClient(config.client),
220+
dcl.WithUserAgent(userAgent),
221+
dcl.WithLogger(dclLogger{}),
222+
dcl.WithBasePath(config.RecaptchaEnterpriseBasePath),
223+
}
224+
225+
if timeout != 0 {
226+
configOptions = append(configOptions, dcl.WithTimeout(timeout))
227+
}
228+
229+
if config.UserProjectOverride {
230+
configOptions = append(configOptions, dcl.WithUserProjectOverride())
231+
if billingProject != "" {
232+
configOptions = append(configOptions, dcl.WithBillingProject(billingProject))
233+
}
234+
}
235+
236+
dclConfig := dcl.NewConfig(configOptions...)
237+
return recaptchaenterprise.NewClient(dclConfig)
238+
}

google/provider_dcl_endpoints.go

+12
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ var PrivatecaEndpointEntry = &schema.Schema{
8585
}, ""),
8686
}
8787

88+
var RecaptchaEnterpriseEndpointEntryKey = "recaptcha_enterprise_custom_endpoint"
89+
var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
90+
Type: schema.TypeString,
91+
Optional: true,
92+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
93+
"GOOGLE_RECAPTCHA_ENTERPRISE_CUSTOM_ENDPOINT",
94+
}, ""),
95+
}
96+
8897
//Add new values to config.go.erb config object declaration
8998
//AssuredWorkloadsBasePath string
9099
//CloudBuildWorkerPoolBasePath string
@@ -93,6 +102,7 @@ var PrivatecaEndpointEntry = &schema.Schema{
93102
//EventarcBasePath string
94103
//OrgPolicyBasePath string
95104
//PrivatecaBasePath string
105+
//RecaptchaEnterpriseBasePath string
96106

97107
//Add new values to provider.go.erb schema initialization
98108
// AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
@@ -102,6 +112,7 @@ var PrivatecaEndpointEntry = &schema.Schema{
102112
// EventarcEndpointEntryKey: EventarcEndpointEntry,
103113
// OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
104114
// PrivatecaEndpointEntryKey: PrivatecaEndpointEntry,
115+
// RecaptchaEnterpriseEndpointEntryKey: RecaptchaEnterpriseEndpointEntry,
105116

106117
//Add new values to provider.go.erb - provider block read
107118
// config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
@@ -111,3 +122,4 @@ var PrivatecaEndpointEntry = &schema.Schema{
111122
// config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
112123
// config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)
113124
// config.PrivatecaBasePath = d.Get(PrivatecaEndpointEntryKey).(string)
125+
// config.RecaptchaEnterpriseBasePath = d.Get(RecaptchaEnterpriseEndpointEntryKey).(string)

google/resource_privateca_certificate_template_generated_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ resource "google_privateca_certificate_template" "primary" {
8181
}
8282
}
8383
84+
labels = {
85+
label-two = "value-two"
86+
}
87+
8488
passthrough_extensions {
8589
additional_extensions {
8690
object_id_path = [1, 6]
@@ -164,6 +168,10 @@ resource "google_privateca_certificate_template" "primary" {
164168
}
165169
}
166170
171+
labels = {
172+
label-one = "value-one"
173+
}
174+
167175
passthrough_extensions {
168176
additional_extensions {
169177
object_id_path = [1, 7]

0 commit comments

Comments
 (0)