Skip to content
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/hashicorp/hcl/v2 v2.23.0
github.com/hashicorp/terraform-json v0.25.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20251117170317-549988e8f23c
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20251117202205-5884d35b833f
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.10.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 h1:NFPMacTrY/IdcIcnUB+7hsor
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0/go.mod h1:QYmYnLfsosrxjCnGY1p9c7Zj6n9thnEE+7RObeYs3fA=
github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c=
github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20251117170317-549988e8f23c h1:wNkGAi9tgMS+QvX9xB066FY6TpihJ4eHVFIHj3c4pBU=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20251117170317-549988e8f23c/go.mod h1:9nRKCi/wR5lugO3OV9JM7yvoiA1nylKSnPMwTLgT+/s=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20251117202205-5884d35b833f h1:bWPussFOwT+fw1P1dXR6WkvhjMl+qDjKR2VpaTk3Tww=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20251117202205-5884d35b833f/go.mod h1:9nRKCi/wR5lugO3OV9JM7yvoiA1nylKSnPMwTLgT+/s=
github.com/hashicorp/terraform-registry-address v0.2.5 h1:2GTftHqmUhVOeuu9CW3kwDkRe4pcBDq0uuK5VJngU1M=
github.com/hashicorp/terraform-registry-address v0.2.5/go.mod h1:PpzXWINwB5kuVS5CA7m1+eO2f1jKb5ZDIxrOPfpnGkg=
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This code is generated by Magic Modules using the following:
//
// Configuration: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/dialogflow/version.yaml
// Template: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/tgc/resource_converter.go.tmpl
//
// DO NOT EDIT this file directly. Any changes made to this file will be
// overwritten during the next generation cycle.
//
// ----------------------------------------------------------------------------

package dialogflow

import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"log"
"reflect"
"regexp"
"slices"
"sort"
"strconv"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"

"github.com/GoogleCloudPlatform/terraform-google-conversion/v7/tfplan2cai/converters/google/resources/cai"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/verify"

"google.golang.org/api/googleapi"
)

var (
_ = bytes.Clone
_ = context.WithCancel
_ = base64.StdEncoding
_ = fmt.Sprintf
_ = json.Marshal
_ = log.Print
_ = reflect.ValueOf
_ = regexp.Match
_ = slices.Min([]int{1})
_ = sort.IntSlice{}
_ = strconv.Atoi
_ = strings.Trim
_ = time.Now
_ = diag.Diagnostic{}
_ = customdiff.All
_ = id.UniqueId
_ = logging.LogLevel
_ = retry.Retry
_ = schema.Noop
_ = structure.ExpandJsonFromString
_ = validation.All
_ = terraform.State{}
_ = tpgresource.SetLabels
_ = transport_tpg.Config{}
_ = verify.ProjectRegex
_ = googleapi.Error{}
)

const DialogflowVersionAssetType string = "dialogflow.googleapis.com/Version"

func ResourceConverterDialogflowVersion() cai.ResourceConverter {
return cai.ResourceConverter{
AssetType: DialogflowVersionAssetType,
Convert: GetDialogflowVersionCaiObject,
}
}

func GetDialogflowVersionCaiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) ([]cai.Asset, error) {
name, err := cai.AssetName(d, config, "//dialogflow.googleapis.com/{{parent}}/versions/{{name}}")
if err != nil {
return []cai.Asset{}, err
}
if obj, err := GetDialogflowVersionApiObject(d, config); err == nil {
return []cai.Asset{{
Name: name,
Type: DialogflowVersionAssetType,
Resource: &cai.AssetResource{
Version: "v2",
DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/dialogflow/v2/rest",
DiscoveryName: "Version",
Data: obj,
},
}}, nil
} else {
return []cai.Asset{}, err
}
}

func GetDialogflowVersionApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) {
obj := make(map[string]interface{})
descriptionProp, err := expandDialogflowVersionDescription(d.Get("description"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}

return obj, nil
}

func expandDialogflowVersionDescription(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}