Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connection resource of Integration Connectors. #16468

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/9328.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:new-resource
`google_integration_connectors_connection`

```
5 changes: 5 additions & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ var services = mapOf(
"displayName" to "Identityplatform",
"path" to "./google/services/identityplatform"
),
"integrationconnectors" to mapOf(
"name" to "integrationconnectors",
"displayName" to "Integrationconnectors",
"path" to "./google/services/integrationconnectors"
),
"kms" to mapOf(
"name" to "kms",
"displayName" to "Kms",
Expand Down
1 change: 1 addition & 0 deletions google/fwmodels/provider_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type ProviderModel struct {
IAMWorkforcePoolCustomEndpoint types.String `tfsdk:"iam_workforce_pool_custom_endpoint"`
IapCustomEndpoint types.String `tfsdk:"iap_custom_endpoint"`
IdentityPlatformCustomEndpoint types.String `tfsdk:"identity_platform_custom_endpoint"`
IntegrationConnectorsCustomEndpoint types.String `tfsdk:"integration_connectors_custom_endpoint"`
KMSCustomEndpoint types.String `tfsdk:"kms_custom_endpoint"`
LoggingCustomEndpoint types.String `tfsdk:"logging_custom_endpoint"`
LookerCustomEndpoint types.String `tfsdk:"looker_custom_endpoint"`
Expand Down
6 changes: 6 additions & 0 deletions google/fwprovider/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"integration_connectors_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"kms_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
Expand Down
10 changes: 10 additions & 0 deletions google/fwtransport/framework_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ type FrameworkProviderConfig struct {
IAMWorkforcePoolBasePath string
IapBasePath string
IdentityPlatformBasePath string
IntegrationConnectorsBasePath string
KMSBasePath string
LoggingBasePath string
LookerBasePath string
Expand Down Expand Up @@ -255,6 +256,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.IAMWorkforcePoolBasePath = data.IAMWorkforcePoolCustomEndpoint.ValueString()
p.IapBasePath = data.IapCustomEndpoint.ValueString()
p.IdentityPlatformBasePath = data.IdentityPlatformCustomEndpoint.ValueString()
p.IntegrationConnectorsBasePath = data.IntegrationConnectorsCustomEndpoint.ValueString()
p.KMSBasePath = data.KMSCustomEndpoint.ValueString()
p.LoggingBasePath = data.LoggingCustomEndpoint.ValueString()
p.LookerBasePath = data.LookerCustomEndpoint.ValueString()
Expand Down Expand Up @@ -937,6 +939,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
data.IdentityPlatformCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.IntegrationConnectorsCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_INTEGRATION_CONNECTORS_CUSTOM_ENDPOINT",
}, transport_tpg.DefaultBasePaths[transport_tpg.IntegrationConnectorsBasePathKey])
if customEndpoint != nil {
data.IntegrationConnectorsCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.KMSCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_KMS_CUSTOM_ENDPOINT",
Expand Down
12 changes: 10 additions & 2 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/iamworkforcepool"
"github.com/hashicorp/terraform-provider-google/google/services/iap"
"github.com/hashicorp/terraform-provider-google/google/services/identityplatform"
"github.com/hashicorp/terraform-provider-google/google/services/integrationconnectors"
"github.com/hashicorp/terraform-provider-google/google/services/kms"
"github.com/hashicorp/terraform-provider-google/google/services/logging"
"github.com/hashicorp/terraform-provider-google/google/services/looker"
Expand Down Expand Up @@ -568,6 +569,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"integration_connectors_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"kms_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1022,9 +1028,9 @@ func DatasourceMapWithErrors() (map[string]*schema.Resource, error) {
})
}

// Generated resources: 338
// Generated resources: 339
// Generated IAM resources: 210
// Total generated resources: 548
// Total generated resources: 549
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1440,6 +1446,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_identity_platform_tenant_default_supported_idp_config": identityplatform.ResourceIdentityPlatformTenantDefaultSupportedIdpConfig(),
"google_identity_platform_tenant_inbound_saml_config": identityplatform.ResourceIdentityPlatformTenantInboundSamlConfig(),
"google_identity_platform_tenant_oauth_idp_config": identityplatform.ResourceIdentityPlatformTenantOauthIdpConfig(),
"google_integration_connectors_connection": integrationconnectors.ResourceIntegrationConnectorsConnection(),
"google_kms_crypto_key": kms.ResourceKMSCryptoKey(),
"google_kms_crypto_key_version": kms.ResourceKMSCryptoKeyVersion(),
"google_kms_key_ring": kms.ResourceKMSKeyRing(),
Expand Down Expand Up @@ -1913,6 +1920,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.IAMWorkforcePoolBasePath = d.Get("iam_workforce_pool_custom_endpoint").(string)
config.IapBasePath = d.Get("iap_custom_endpoint").(string)
config.IdentityPlatformBasePath = d.Get("identity_platform_custom_endpoint").(string)
config.IntegrationConnectorsBasePath = d.Get("integration_connectors_custom_endpoint").(string)
config.KMSBasePath = d.Get("kms_custom_endpoint").(string)
config.LoggingBasePath = d.Get("logging_custom_endpoint").(string)
config.LookerBasePath = d.Get("looker_custom_endpoint").(string)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------

package integrationconnectors

import (
"encoding/json"
"errors"
"fmt"
"time"

"github.com/hashicorp/terraform-provider-google/google/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
)

type IntegrationConnectorsOperationWaiter struct {
Config *transport_tpg.Config
UserAgent string
Project string
tpgresource.CommonOperationWaiter
}

func (w *IntegrationConnectorsOperationWaiter) QueryOp() (interface{}, error) {
if w == nil {
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
}
// Returns the proper get.
url := fmt.Sprintf("%s%s", w.Config.IntegrationConnectorsBasePath, w.CommonOperationWaiter.Op.Name)

return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: w.Config,
Method: "GET",
Project: w.Project,
RawURL: url,
UserAgent: w.UserAgent,
})
}

func createIntegrationConnectorsWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*IntegrationConnectorsOperationWaiter, error) {
w := &IntegrationConnectorsOperationWaiter{
Config: config,
UserAgent: userAgent,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func IntegrationConnectorsOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createIntegrationConnectorsWaiter(config, op, project, activity, userAgent)
if err != nil {
return err
}
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
return err
}
rawResponse := []byte(w.CommonOperationWaiter.Op.Response)
if len(rawResponse) == 0 {
return errors.New("`resource` not set in operation response")
}
return json.Unmarshal(rawResponse, response)
}

func IntegrationConnectorsOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
if val, ok := op["name"]; !ok || val == "" {
// This was a synchronous call - there is no operation to wait for.
return nil
}
w, err := createIntegrationConnectorsWaiter(config, op, project, activity, userAgent)
if err != nil {
// If w is nil, the op was synchronous.
return err
}
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
}
Loading