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

Expand Terraform for Developer Connect #20823

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
9 changes: 9 additions & 0 deletions .changelog/12391.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```release-note:enhancement
developerconnect: added `crypto_key_config`, `github_enterprise_config`, `gitlab_config` , and `gitlab_enterprise_config` fields to `google_developer_connect_connection` resource (beta)
```
```release-note:new-resource
`google_developer_connect_git_repository_link` (ga)
```
```release-note:new-resource
`google_developer_connect_connection` (ga)
```
1 change: 1 addition & 0 deletions google/fwmodels/provider_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type ProviderModel struct {
DataprocMetastoreCustomEndpoint types.String `tfsdk:"dataproc_metastore_custom_endpoint"`
DatastreamCustomEndpoint types.String `tfsdk:"datastream_custom_endpoint"`
DeploymentManagerCustomEndpoint types.String `tfsdk:"deployment_manager_custom_endpoint"`
DeveloperConnectCustomEndpoint types.String `tfsdk:"developer_connect_custom_endpoint"`
DialogflowCustomEndpoint types.String `tfsdk:"dialogflow_custom_endpoint"`
DialogflowCXCustomEndpoint types.String `tfsdk:"dialogflow_cx_custom_endpoint"`
DiscoveryEngineCustomEndpoint types.String `tfsdk:"discovery_engine_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 @@ -472,6 +472,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"developer_connect_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"dialogflow_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
Expand Down
6 changes: 6 additions & 0 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"developer_connect_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"dialogflow_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1036,6 +1041,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.DataprocMetastoreBasePath = d.Get("dataproc_metastore_custom_endpoint").(string)
config.DatastreamBasePath = d.Get("datastream_custom_endpoint").(string)
config.DeploymentManagerBasePath = d.Get("deployment_manager_custom_endpoint").(string)
config.DeveloperConnectBasePath = d.Get("developer_connect_custom_endpoint").(string)
config.DialogflowBasePath = d.Get("dialogflow_custom_endpoint").(string)
config.DialogflowCXBasePath = d.Get("dialogflow_cx_custom_endpoint").(string)
config.DiscoveryEngineBasePath = d.Get("discovery_engine_custom_endpoint").(string)
Expand Down
7 changes: 5 additions & 2 deletions google/provider/provider_mmv1_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/dataprocmetastore"
"github.com/hashicorp/terraform-provider-google/google/services/datastream"
"github.com/hashicorp/terraform-provider-google/google/services/deploymentmanager"
"github.com/hashicorp/terraform-provider-google/google/services/developerconnect"
"github.com/hashicorp/terraform-provider-google/google/services/dialogflow"
"github.com/hashicorp/terraform-provider-google/google/services/dialogflowcx"
"github.com/hashicorp/terraform-provider-google/google/services/discoveryengine"
Expand Down Expand Up @@ -463,9 +464,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
}

// Resources
// Generated resources: 501
// Generated resources: 503
// Generated IAM resources: 261
// Total generated resources: 762
// Total generated resources: 764
var generatedResources = map[string]*schema.Resource{
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
Expand Down Expand Up @@ -821,6 +822,8 @@ var generatedResources = map[string]*schema.Resource{
"google_datastream_private_connection": datastream.ResourceDatastreamPrivateConnection(),
"google_datastream_stream": datastream.ResourceDatastreamStream(),
"google_deployment_manager_deployment": deploymentmanager.ResourceDeploymentManagerDeployment(),
"google_developer_connect_connection": developerconnect.ResourceDeveloperConnectConnection(),
"google_developer_connect_git_repository_link": developerconnect.ResourceDeveloperConnectGitRepositoryLink(),
"google_dialogflow_agent": dialogflow.ResourceDialogflowAgent(),
"google_dialogflow_entity_type": dialogflow.ResourceDialogflowEntityType(),
"google_dialogflow_fulfillment": dialogflow.ResourceDialogflowFulfillment(),
Expand Down
92 changes: 92 additions & 0 deletions google/services/developerconnect/developer_connect_operation.go
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 developerconnect

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 DeveloperConnectOperationWaiter struct {
Config *transport_tpg.Config
UserAgent string
Project string
tpgresource.CommonOperationWaiter
}

func (w *DeveloperConnectOperationWaiter) 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.DeveloperConnectBasePath, 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 createDeveloperConnectWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*DeveloperConnectOperationWaiter, error) {
w := &DeveloperConnectOperationWaiter{
Config: config,
UserAgent: userAgent,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func DeveloperConnectOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createDeveloperConnectWaiter(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 DeveloperConnectOperationWaitTime(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 := createDeveloperConnectWaiter(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
Loading