Skip to content

Commit

Permalink
add recaptcha enterprise key resource (#5507) (#10672)
Browse files Browse the repository at this point in the history
* add recaptcha enterprise key resource

* add version beta to iosKey sample

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Dec 2, 2021
1 parent 9e1bfe0 commit 7434d9f
Show file tree
Hide file tree
Showing 15 changed files with 1,417 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/5507.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_recaptcha_enterprise_key`
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/hashicorp/terraform-provider-google
require (
cloud.google.com/go/bigtable v1.10.1
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211117235310-d31aef517fa2
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811
github.com/apparentlymart/go-cidr v1.1.0
github.com/client9/misspell v0.3.4
github.com/davecgh/go-spew v1.1.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1440,3 +1440,7 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-202110
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211026195335-4a6ae4ac04de/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518 h1:tFdFasG+VDpnn+BfVbZrfGcoH6pw6s7ODYlZlhTO3UM=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211027225138-ef28ca390518/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211129235756-547215b5e6ef h1:f+09BJVg+I/SObjSguOGGoSQHlT/Y1c8ah+nz1bkppI=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211129235756-547215b5e6ef/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811 h1:j1JJXw1MuANOPXJcruRaKIYIfPMNUwksphKSQruFF6w=
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211201210024-59e87ee7d811/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU=
1 change: 1 addition & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ type Config struct {
EventarcBasePath string
GkeHubBasePath string
OrgPolicyBasePath string
RecaptchaEnterpriseBasePath string
// CloudBuild WorkerPool uses a different endpoint (v1beta1) than any other CloudBuild resources
CloudBuildWorkerPoolBasePath string
}
Expand Down
2 changes: 2 additions & 0 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ func Provider() *schema.Provider {
GkeHubFeatureCustomEndpointEntryKey: GkeHubFeatureCustomEndpointEntry,
OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
PrivatecaCertificateTemplateEndpointEntryKey: PrivatecaCertificateTemplateCustomEndpointEntry,
RecaptchaEnterpriseEndpointEntryKey: RecaptchaEnterpriseEndpointEntry,

CloudBuildWorkerPoolEndpointEntryKey: CloudBuildWorkerPoolEndpointEntry,
},
Expand Down Expand Up @@ -1209,6 +1210,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_eventarc_trigger": resourceEventarcTrigger(),
"google_org_policy_policy": resourceOrgPolicyPolicy(),
"google_privateca_certificate_template": resourcePrivatecaCertificateTemplate(),
"google_recaptcha_enterprise_key": resourceRecaptchaEnterpriseKey(),
},
// ------------------------------------
map[string]*schema.Resource{
Expand Down
24 changes: 24 additions & 0 deletions google/provider_dcl_client_creation.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc"
orgpolicy "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/orgpolicy"
privateca "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/privateca"
recaptchaenterprise "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/recaptchaenterprise"
)

func NewDCLAssuredWorkloadsClient(config *Config, userAgent, billingProject string, timeout time.Duration) *assuredworkloads.Client {
Expand Down Expand Up @@ -212,3 +213,26 @@ func NewDCLPrivatecaClient(config *Config, userAgent, billingProject string, tim
dclConfig := dcl.NewConfig(configOptions...)
return privateca.NewClient(dclConfig)
}

func NewDCLRecaptchaEnterpriseClient(config *Config, userAgent, billingProject string, timeout time.Duration) *recaptchaenterprise.Client {
configOptions := []dcl.ConfigOption{
dcl.WithHTTPClient(config.client),
dcl.WithUserAgent(userAgent),
dcl.WithLogger(dclLogger{}),
dcl.WithBasePath(config.RecaptchaEnterpriseBasePath),
}

if timeout != 0 {
configOptions = append(configOptions, dcl.WithTimeout(timeout))
}

if config.UserProjectOverride {
configOptions = append(configOptions, dcl.WithUserProjectOverride())
if billingProject != "" {
configOptions = append(configOptions, dcl.WithBillingProject(billingProject))
}
}

dclConfig := dcl.NewConfig(configOptions...)
return recaptchaenterprise.NewClient(dclConfig)
}
12 changes: 12 additions & 0 deletions google/provider_dcl_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ var PrivatecaEndpointEntry = &schema.Schema{
}, ""),
}

var RecaptchaEnterpriseEndpointEntryKey = "recaptcha_enterprise_custom_endpoint"
var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_RECAPTCHA_ENTERPRISE_CUSTOM_ENDPOINT",
}, ""),
}

//Add new values to config.go.erb config object declaration
//AssuredWorkloadsBasePath string
//CloudBuildWorkerPoolBasePath string
Expand All @@ -93,6 +102,7 @@ var PrivatecaEndpointEntry = &schema.Schema{
//EventarcBasePath string
//OrgPolicyBasePath string
//PrivatecaBasePath string
//RecaptchaEnterpriseBasePath string

//Add new values to provider.go.erb schema initialization
// AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
Expand All @@ -102,6 +112,7 @@ var PrivatecaEndpointEntry = &schema.Schema{
// EventarcEndpointEntryKey: EventarcEndpointEntry,
// OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
// PrivatecaEndpointEntryKey: PrivatecaEndpointEntry,
// RecaptchaEnterpriseEndpointEntryKey: RecaptchaEnterpriseEndpointEntry,

//Add new values to provider.go.erb - provider block read
// config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
Expand All @@ -111,3 +122,4 @@ var PrivatecaEndpointEntry = &schema.Schema{
// config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
// config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)
// config.PrivatecaBasePath = d.Get(PrivatecaEndpointEntryKey).(string)
// config.RecaptchaEnterpriseBasePath = d.Get(RecaptchaEnterpriseEndpointEntryKey).(string)
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ resource "google_privateca_certificate_template" "primary" {
}
}
labels = {
label-two = "value-two"
}
passthrough_extensions {
additional_extensions {
object_id_path = [1, 6]
Expand Down Expand Up @@ -164,6 +168,10 @@ resource "google_privateca_certificate_template" "primary" {
}
}
labels = {
label-one = "value-one"
}
passthrough_extensions {
additional_extensions {
object_id_path = [1, 7]
Expand Down
Loading

0 comments on commit 7434d9f

Please sign in to comment.