Repository: GoogleCloudPlatform/terraform-validator
Pull request #1455 (2023-03-14 18:31:53)

update BigqueryDatapolicy to ga
<!-- Put a description of what this PR is for here, along with any references to issues that this resolves or contributes to -->




<!--
Replace each [ ] with [X] to check it. Switch to the preview view to make it easier to click on links.
These steps will speed up the review process, and we appreciate you spending time on them before sending
your code to be reviewed.
-->
If this PR is for Terraform, I acknowledge that I have:

- [x] Searched through the [issue tracker](https://github.com/hashicorp/terraform-provider-google/issues) for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
- [x] [Generated Terraform](https://github.com/GoogleCloudPlatform/magic-modules#generating-the-terraform-providers), and ran `make test` and `make lint` to ensure it passes unit and linter tests.
- [x] Ensured that all new fields I added that can be set by a user appear in at least one [example](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform/examples) (for generated resources) or [third_party test](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/tests) (for handwritten resources or update tests).
- [x] [Ran](https://github.com/hashicorp/terraform-provider-google/blob/main/.github/CONTRIBUTING.md#tests) relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
- [x] Read the [Release Notes Guide](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/.ci/RELEASE_NOTES_GUIDE.md) before writing my release note below.

<!-- AUTOCHANGELOG for Downstream PRs.

Please select one of the following "release-note:" headings:
    - release-note:enhancement
    - release-note:bug
    - release-note:note
    - release-note:new-resource
    - release-note:new-datasource
    - release-note:deprecation
    - release-note:breaking-change
    - release-note:none
    
Unless you choose release-note:none, please add a release note.

See .ci/RELEASE_NOTES_GUIDE.md for writing good release notes.

You can add more release note blocks if you want more than one CHANGELOG
entry for this PR.
-->
**Release Note Template for Downstream PRs (will be copied)**

```release-note:enhancement
bigquerydatapolicy: promoted `google_bigquery_datapolicy_data_policy` to GA
```

Derived from https://github.com/GoogleCloudPlatform/magic-modules/pull/6797


Patch:
diff --git a/converters/google/resources/bigquery_datapolicy_data_policy_iam.go b/converters/google/resources/bigquery_datapolicy_data_policy_iam.go
new file mode 100644
index 00000000..272acccd
--- /dev/null
+++ b/converters/google/resources/bigquery_datapolicy_data_policy_iam.go
@@ -0,0 +1,123 @@
+// ----------------------------------------------------------------------------
+//
+//     ***     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 google
+
+import "fmt"
+
+// Provide a separate asset type constant so we don't have to worry about name conflicts between IAM and non-IAM converter files
+const BigqueryDatapolicyDataPolicyIAMAssetType string = "bigquerydatapolicy.googleapis.com/DataPolicy"
+
+func resourceConverterBigqueryDatapolicyDataPolicyIamPolicy() ResourceConverter {
+	return ResourceConverter{
+		AssetType:         BigqueryDatapolicyDataPolicyIAMAssetType,
+		Convert:           GetBigqueryDatapolicyDataPolicyIamPolicyCaiObject,
+		MergeCreateUpdate: MergeBigqueryDatapolicyDataPolicyIamPolicy,
+	}
+}
+
+func resourceConverterBigqueryDatapolicyDataPolicyIamBinding() ResourceConverter {
+	return ResourceConverter{
+		AssetType:         BigqueryDatapolicyDataPolicyIAMAssetType,
+		Convert:           GetBigqueryDatapolicyDataPolicyIamBindingCaiObject,
+		FetchFullResource: FetchBigqueryDatapolicyDataPolicyIamPolicy,
+		MergeCreateUpdate: MergeBigqueryDatapolicyDataPolicyIamBinding,
+		MergeDelete:       MergeBigqueryDatapolicyDataPolicyIamBindingDelete,
+	}
+}
+
+func resourceConverterBigqueryDatapolicyDataPolicyIamMember() ResourceConverter {
+	return ResourceConverter{
+		AssetType:         BigqueryDatapolicyDataPolicyIAMAssetType,
+		Convert:           GetBigqueryDatapolicyDataPolicyIamMemberCaiObject,
+		FetchFullResource: FetchBigqueryDatapolicyDataPolicyIamPolicy,
+		MergeCreateUpdate: MergeBigqueryDatapolicyDataPolicyIamMember,
+		MergeDelete:       MergeBigqueryDatapolicyDataPolicyIamMemberDelete,
+	}
+}
+
+func GetBigqueryDatapolicyDataPolicyIamPolicyCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
+	return newBigqueryDatapolicyDataPolicyIamAsset(d, config, expandIamPolicyBindings)
+}
+
+func GetBigqueryDatapolicyDataPolicyIamBindingCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
+	return newBigqueryDatapolicyDataPolicyIamAsset(d, config, expandIamRoleBindings)
+}
+
+func GetBigqueryDatapolicyDataPolicyIamMemberCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
+	return newBigqueryDatapolicyDataPolicyIamAsset(d, config, expandIamMemberBindings)
+}
+
+func MergeBigqueryDatapolicyDataPolicyIamPolicy(existing, incoming Asset) Asset {
+	existing.IAMPolicy = incoming.IAMPolicy
+	return existing
+}
+
+func MergeBigqueryDatapolicyDataPolicyIamBinding(existing, incoming Asset) Asset {
+	return mergeIamAssets(existing, incoming, mergeAuthoritativeBindings)
+}
+
+func MergeBigqueryDatapolicyDataPolicyIamBindingDelete(existing, incoming Asset) Asset {
+	return mergeDeleteIamAssets(existing, incoming, mergeDeleteAuthoritativeBindings)
+}
+
+func MergeBigqueryDatapolicyDataPolicyIamMember(existing, incoming Asset) Asset {
+	return mergeIamAssets(existing, incoming, mergeAdditiveBindings)
+}
+
+func MergeBigqueryDatapolicyDataPolicyIamMemberDelete(existing, incoming Asset) Asset {
+	return mergeDeleteIamAssets(existing, incoming, mergeDeleteAdditiveBindings)
+}
+
+func newBigqueryDatapolicyDataPolicyIamAsset(
+	d TerraformResourceData,
+	config *Config,
+	expandBindings func(d TerraformResourceData) ([]IAMBinding, error),
+) ([]Asset, error) {
+	bindings, err := expandBindings(d)
+	if err != nil {
+		return []Asset{}, fmt.Errorf("expanding bindings: %v", err)
+	}
+
+	name, err := assetName(d, config, "//bigquerydatapolicy.googleapis.com/projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}")
+	if err != nil {
+		return []Asset{}, err
+	}
+
+	return []Asset{{
+		Name: name,
+		Type: BigqueryDatapolicyDataPolicyIAMAssetType,
+		IAMPolicy: &IAMPolicy{
+			Bindings: bindings,
+		},
+	}}, nil
+}
+
+func FetchBigqueryDatapolicyDataPolicyIamPolicy(d TerraformResourceData, config *Config) (Asset, error) {
+	// Check if the identity field returns a value
+	if _, ok := d.GetOk("location"); !ok {
+		return Asset{}, ErrEmptyIdentityField
+	}
+	if _, ok := d.GetOk("data_policy_id"); !ok {
+		return Asset{}, ErrEmptyIdentityField
+	}
+
+	return fetchIamPolicy(
+		BigqueryDatapolicyDataPolicyIamUpdaterProducer,
+		d,
+		config,
+		"//bigquerydatapolicy.googleapis.com/projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}",
+		BigqueryDatapolicyDataPolicyIAMAssetType,
+	)
+}
diff --git a/converters/google/resources/bigquerydatapolicy_data_policy.go b/converters/google/resources/bigquerydatapolicy_data_policy.go
new file mode 100644
index 00000000..d281f42c
--- /dev/null
+++ b/converters/google/resources/bigquerydatapolicy_data_policy.go
@@ -0,0 +1,112 @@
+// ----------------------------------------------------------------------------
+//
+//     ***     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 google
+
+import "reflect"
+
+const BigqueryDatapolicyDataPolicyAssetType string = "bigquerydatapolicy.googleapis.com/DataPolicy"
+
+func resourceConverterBigqueryDatapolicyDataPolicy() ResourceConverter {
+	return ResourceConverter{
+		AssetType: BigqueryDatapolicyDataPolicyAssetType,
+		Convert:   GetBigqueryDatapolicyDataPolicyCaiObject,
+	}
+}
+
+func GetBigqueryDatapolicyDataPolicyCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
+	name, err := assetName(d, config, "//bigquerydatapolicy.googleapis.com/projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}")
+	if err != nil {
+		return []Asset{}, err
+	}
+	if obj, err := GetBigqueryDatapolicyDataPolicyApiObject(d, config); err == nil {
+		return []Asset{{
+			Name: name,
+			Type: BigqueryDatapolicyDataPolicyAssetType,
+			Resource: &AssetResource{
+				Version:              "v1",
+				DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/bigquerydatapolicy/v1/rest",
+				DiscoveryName:        "DataPolicy",
+				Data:                 obj,
+			},
+		}}, nil
+	} else {
+		return []Asset{}, err
+	}
+}
+
+func GetBigqueryDatapolicyDataPolicyApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) {
+	obj := make(map[string]interface{})
+	dataPolicyIdProp, err := expandBigqueryDatapolicyDataPolicyDataPolicyId(d.Get("data_policy_id"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("data_policy_id"); !isEmptyValue(reflect.ValueOf(dataPolicyIdProp)) && (ok || !reflect.DeepEqual(v, dataPolicyIdProp)) {
+		obj["dataPolicyId"] = dataPolicyIdProp
+	}
+	policyTagProp, err := expandBigqueryDatapolicyDataPolicyPolicyTag(d.Get("policy_tag"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("policy_tag"); !isEmptyValue(reflect.ValueOf(policyTagProp)) && (ok || !reflect.DeepEqual(v, policyTagProp)) {
+		obj["policyTag"] = policyTagProp
+	}
+	dataPolicyTypeProp, err := expandBigqueryDatapolicyDataPolicyDataPolicyType(d.Get("data_policy_type"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("data_policy_type"); !isEmptyValue(reflect.ValueOf(dataPolicyTypeProp)) && (ok || !reflect.DeepEqual(v, dataPolicyTypeProp)) {
+		obj["dataPolicyType"] = dataPolicyTypeProp
+	}
+	dataMaskingPolicyProp, err := expandBigqueryDatapolicyDataPolicyDataMaskingPolicy(d.Get("data_masking_policy"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("data_masking_policy"); !isEmptyValue(reflect.ValueOf(dataMaskingPolicyProp)) && (ok || !reflect.DeepEqual(v, dataMaskingPolicyProp)) {
+		obj["dataMaskingPolicy"] = dataMaskingPolicyProp
+	}
+
+	return obj, nil
+}
+
+func expandBigqueryDatapolicyDataPolicyDataPolicyId(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandBigqueryDatapolicyDataPolicyPolicyTag(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandBigqueryDatapolicyDataPolicyDataPolicyType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandBigqueryDatapolicyDataPolicyDataMaskingPolicy(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	l := v.([]interface{})
+	if len(l) == 0 || l[0] == nil {
+		return nil, nil
+	}
+	raw := l[0]
+	original := raw.(map[string]interface{})
+	transformed := make(map[string]interface{})
+
+	transformedPredefinedExpression, err := expandBigqueryDatapolicyDataPolicyDataMaskingPolicyPredefinedExpression(original["predefined_expression"], d, config)
+	if err != nil {
+		return nil, err
+	} else if val := reflect.ValueOf(transformedPredefinedExpression); val.IsValid() && !isEmptyValue(val) {
+		transformed["predefinedExpression"] = transformedPredefinedExpression
+	}
+
+	return transformed, nil
+}
+
+func expandBigqueryDatapolicyDataPolicyDataMaskingPolicyPredefinedExpression(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
diff --git a/converters/google/resources/config.go b/converters/google/resources/config.go
index 425fbd24..65ca04bb 100644
--- a/converters/google/resources/config.go
+++ b/converters/google/resources/config.go
@@ -183,6 +183,7 @@ type Config struct {
 	BigQueryBasePath             string
 	BigqueryAnalyticsHubBasePath string
 	BigqueryConnectionBasePath   string
+	BigqueryDatapolicyBasePath   string
 	BigqueryDataTransferBasePath string
 	BigqueryReservationBasePath  string
 	BigtableBasePath             string
@@ -288,6 +289,7 @@ const BeyondcorpBasePathKey = "Beyondcorp"
 const BigQueryBasePathKey = "BigQuery"
 const BigqueryAnalyticsHubBasePathKey = "BigqueryAnalyticsHub"
 const BigqueryConnectionBasePathKey = "BigqueryConnection"
+const BigqueryDatapolicyBasePathKey = "BigqueryDatapolicy"
 const BigqueryDataTransferBasePathKey = "BigqueryDataTransfer"
 const BigqueryReservationBasePathKey = "BigqueryReservation"
 const BigtableBasePathKey = "Bigtable"
@@ -387,6 +389,7 @@ var DefaultBasePaths = map[string]string{
 	BigQueryBasePathKey:             "https://bigquery.googleapis.com/bigquery/v2/",
 	BigqueryAnalyticsHubBasePathKey: "https://analyticshub.googleapis.com/v1/",
 	BigqueryConnectionBasePathKey:   "https://bigqueryconnection.googleapis.com/v1/",
+	BigqueryDatapolicyBasePathKey:   "https://bigquerydatapolicy.googleapis.com/v1/",
 	BigqueryDataTransferBasePathKey: "https://bigquerydatatransfer.googleapis.com/v1/",
 	BigqueryReservationBasePathKey:  "https://bigqueryreservation.googleapis.com/v1/",
 	BigtableBasePathKey:             "https://bigtableadmin.googleapis.com/v2/",
@@ -1262,6 +1265,7 @@ func ConfigureBasePaths(c *Config) {
 	c.BigQueryBasePath = DefaultBasePaths[BigQueryBasePathKey]
 	c.BigqueryAnalyticsHubBasePath = DefaultBasePaths[BigqueryAnalyticsHubBasePathKey]
 	c.BigqueryConnectionBasePath = DefaultBasePaths[BigqueryConnectionBasePathKey]
+	c.BigqueryDatapolicyBasePath = DefaultBasePaths[BigqueryDatapolicyBasePathKey]
 	c.BigqueryDataTransferBasePath = DefaultBasePaths[BigqueryDataTransferBasePathKey]
 	c.BigqueryReservationBasePath = DefaultBasePaths[BigqueryReservationBasePathKey]
 	c.BigtableBasePath = DefaultBasePaths[BigtableBasePathKey]
diff --git a/converters/google/resources/iam_bigquery_datapolicy_data_policy.go b/converters/google/resources/iam_bigquery_datapolicy_data_policy.go
new file mode 100644
index 00000000..82e1b765
--- /dev/null
+++ b/converters/google/resources/iam_bigquery_datapolicy_data_policy.go
@@ -0,0 +1,223 @@
+// ----------------------------------------------------------------------------
+//
+//     ***     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 google
+
+import (
+	"fmt"
+
+	"github.com/hashicorp/errwrap"
+	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+	"google.golang.org/api/cloudresourcemanager/v1"
+)
+
+var BigqueryDatapolicyDataPolicyIamSchema = map[string]*schema.Schema{
+	"project": {
+		Type:     schema.TypeString,
+		Computed: true,
+		Optional: true,
+		ForceNew: true,
+	},
+	"location": {
+		Type:     schema.TypeString,
+		Computed: true,
+		Optional: true,
+		ForceNew: true,
+	},
+	"data_policy_id": {
+		Type:             schema.TypeString,
+		Required:         true,
+		ForceNew:         true,
+		DiffSuppressFunc: compareSelfLinkOrResourceName,
+	},
+}
+
+type BigqueryDatapolicyDataPolicyIamUpdater struct {
+	project      string
+	location     string
+	dataPolicyId string
+	d            TerraformResourceData
+	Config       *Config
+}
+
+func BigqueryDatapolicyDataPolicyIamUpdaterProducer(d TerraformResourceData, config *Config) (ResourceIamUpdater, error) {
+	values := make(map[string]string)
+
+	project, _ := getProject(d, config)
+	if project != "" {
+		if err := d.Set("project", project); err != nil {
+			return nil, fmt.Errorf("Error setting project: %s", err)
+		}
+	}
+	values["project"] = project
+	location, _ := getLocation(d, config)
+	if location != "" {
+		if err := d.Set("location", location); err != nil {
+			return nil, fmt.Errorf("Error setting location: %s", err)
+		}
+	}
+	values["location"] = location
+	if v, ok := d.GetOk("data_policy_id"); ok {
+		values["data_policy_id"] = v.(string)
+	}
+
+	// We may have gotten either a long or short name, so attempt to parse long name if possible
+	m, err := getImportIdQualifiers([]string{"projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/dataPolicies/(?P<data_policy_id>[^/]+)", "(?P<project>[^/]+)/(?P<location>[^/]+)/(?P<data_policy_id>[^/]+)", "(?P<location>[^/]+)/(?P<data_policy_id>[^/]+)", "(?P<data_policy_id>[^/]+)"}, d, config, d.Get("data_policy_id").(string))
+	if err != nil {
+		return nil, err
+	}
+
+	for k, v := range m {
+		values[k] = v
+	}
+
+	u := &BigqueryDatapolicyDataPolicyIamUpdater{
+		project:      values["project"],
+		location:     values["location"],
+		dataPolicyId: values["data_policy_id"],
+		d:            d,
+		Config:       config,
+	}
+
+	if err := d.Set("project", u.project); err != nil {
+		return nil, fmt.Errorf("Error setting project: %s", err)
+	}
+	if err := d.Set("location", u.location); err != nil {
+		return nil, fmt.Errorf("Error setting location: %s", err)
+	}
+	if err := d.Set("data_policy_id", u.GetResourceId()); err != nil {
+		return nil, fmt.Errorf("Error setting data_policy_id: %s", err)
+	}
+
+	return u, nil
+}
+
+func BigqueryDatapolicyDataPolicyIdParseFunc(d *schema.ResourceData, config *Config) error {
+	values := make(map[string]string)
+
+	project, _ := getProject(d, config)
+	if project != "" {
+		values["project"] = project
+	}
+
+	location, _ := getLocation(d, config)
+	if location != "" {
+		values["location"] = location
+	}
+
+	m, err := getImportIdQualifiers([]string{"projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/dataPolicies/(?P<data_policy_id>[^/]+)", "(?P<project>[^/]+)/(?P<location>[^/]+)/(?P<data_policy_id>[^/]+)", "(?P<location>[^/]+)/(?P<data_policy_id>[^/]+)", "(?P<data_policy_id>[^/]+)"}, d, config, d.Id())
+	if err != nil {
+		return err
+	}
+
+	for k, v := range m {
+		values[k] = v
+	}
+
+	u := &BigqueryDatapolicyDataPolicyIamUpdater{
+		project:      values["project"],
+		location:     values["location"],
+		dataPolicyId: values["data_policy_id"],
+		d:            d,
+		Config:       config,
+	}
+	if err := d.Set("data_policy_id", u.GetResourceId()); err != nil {
+		return fmt.Errorf("Error setting data_policy_id: %s", err)
+	}
+	d.SetId(u.GetResourceId())
+	return nil
+}
+
+func (u *BigqueryDatapolicyDataPolicyIamUpdater) GetResourceIamPolicy() (*cloudresourcemanager.Policy, error) {
+	url, err := u.qualifyDataPolicyUrl("getIamPolicy")
+	if err != nil {
+		return nil, err
+	}
+
+	project, err := getProject(u.d, u.Config)
+	if err != nil {
+		return nil, err
+	}
+	var obj map[string]interface{}
+
+	userAgent, err := generateUserAgentString(u.d, u.Config.UserAgent)
+	if err != nil {
+		return nil, err
+	}
+
+	policy, err := SendRequest(u.Config, "POST", project, url, userAgent, obj)
+	if err != nil {
+		return nil, errwrap.Wrapf(fmt.Sprintf("Error retrieving IAM policy for %s: {{err}}", u.DescribeResource()), err)
+	}
+
+	out := &cloudresourcemanager.Policy{}
+	err = Convert(policy, out)
+	if err != nil {
+		return nil, errwrap.Wrapf("Cannot convert a policy to a resource manager policy: {{err}}", err)
+	}
+
+	return out, nil
+}
+
+func (u *BigqueryDatapolicyDataPolicyIamUpdater) SetResourceIamPolicy(policy *cloudresourcemanager.Policy) error {
+	json, err := ConvertToMap(policy)
+	if err != nil {
+		return err
+	}
+
+	obj := make(map[string]interface{})
+	obj["policy"] = json
+
+	url, err := u.qualifyDataPolicyUrl("setIamPolicy")
+	if err != nil {
+		return err
+	}
+	project, err := getProject(u.d, u.Config)
+	if err != nil {
+		return err
+	}
+
+	userAgent, err := generateUserAgentString(u.d, u.Config.UserAgent)
+	if err != nil {
+		return err
+	}
+
+	_, err = SendRequestWithTimeout(u.Config, "POST", project, url, userAgent, obj, u.d.Timeout(schema.TimeoutCreate))
+	if err != nil {
+		return errwrap.Wrapf(fmt.Sprintf("Error setting IAM policy for %s: {{err}}", u.DescribeResource()), err)
+	}
+
+	return nil
+}
+
+func (u *BigqueryDatapolicyDataPolicyIamUpdater) qualifyDataPolicyUrl(methodIdentifier string) (string, error) {
+	urlTemplate := fmt.Sprintf("{{BigqueryDatapolicyBasePath}}%s:%s", fmt.Sprintf("projects/%s/locations/%s/dataPolicies/%s", u.project, u.location, u.dataPolicyId), methodIdentifier)
+	url, err := replaceVars(u.d, u.Config, urlTemplate)
+	if err != nil {
+		return "", err
+	}
+	return url, nil
+}
+
+func (u *BigqueryDatapolicyDataPolicyIamUpdater) GetResourceId() string {
+	return fmt.Sprintf("projects/%s/locations/%s/dataPolicies/%s", u.project, u.location, u.dataPolicyId)
+}
+
+func (u *BigqueryDatapolicyDataPolicyIamUpdater) GetMutexKey() string {
+	return fmt.Sprintf("iam-bigquerydatapolicy-datapolicy-%s", u.GetResourceId())
+}
+
+func (u *BigqueryDatapolicyDataPolicyIamUpdater) DescribeResource() string {
+	return fmt.Sprintf("bigquerydatapolicy datapolicy %q", u.GetResourceId())
+}
diff --git a/converters/google/resources/resource_converters.go b/converters/google/resources/resource_converters.go
index 4f96c1d5..8e929d83 100644
--- a/converters/google/resources/resource_converters.go
+++ b/converters/google/resources/resource_converters.go
@@ -102,6 +102,9 @@ func ResourceConverters() map[string][]ResourceConverter {
 		"google_bigquery_connection_iam_policy":                   {resourceConverterBigqueryConnectionConnectionIamPolicy()},
 		"google_bigquery_connection_iam_binding":                  {resourceConverterBigqueryConnectionConnectionIamBinding()},
 		"google_bigquery_connection_iam_member":                   {resourceConverterBigqueryConnectionConnectionIamMember()},
+		"google_bigquery_datapolicy_data_policy_iam_policy":       {resourceConverterBigqueryDatapolicyDataPolicyIamPolicy()},
+		"google_bigquery_datapolicy_data_policy_iam_binding":      {resourceConverterBigqueryDatapolicyDataPolicyIamBinding()},
+		"google_bigquery_datapolicy_data_policy_iam_member":       {resourceConverterBigqueryDatapolicyDataPolicyIamMember()},
 		"google_binary_authorization_attestor_iam_policy":         {resourceConverterBinaryAuthorizationAttestorIamPolicy()},
 		"google_binary_authorization_attestor_iam_binding":        {resourceConverterBinaryAuthorizationAttestorIamBinding()},
 		"google_binary_authorization_attestor_iam_member":         {resourceConverterBinaryAuthorizationAttestorIamMember()},
diff --git a/go.mod b/go.mod
index 6269e8c7..85accfc2 100644
--- a/go.mod
+++ b/go.mod
@@ -26,7 +26,7 @@ require (
 	github.com/hashicorp/go-cleanhttp v0.5.2
 	github.com/hashicorp/terraform-json v0.14.0
 	github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
-	github.com/hashicorp/terraform-provider-google v1.20.1-0.20230314171803-c10c326bcb26
+	github.com/hashicorp/terraform-provider-google v1.20.1-0.20230314182612-5859155c781b
 	github.com/mitchellh/go-homedir v1.1.0
 	github.com/pkg/errors v0.9.1
 	github.com/sirupsen/logrus v1.9.0
diff --git a/go.sum b/go.sum
index 5e9197b6..c33a4e01 100644
--- a/go.sum
+++ b/go.sum
@@ -514,8 +514,8 @@ github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R
 github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4=
 github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 h1:FtCLTiTcykdsURXPt/ku7fYXm3y19nbzbZcUxHx9RbI=
 github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0/go.mod h1:80wf5oad1tW+oLnbXS4UTYmDCrl7BuN1Q+IA91X1a4Y=
-github.com/hashicorp/terraform-provider-google v1.20.1-0.20230314171803-c10c326bcb26 h1:ODZz4ZvzFRggSD9ZI+pqH1whqAvY4caBHgjW4FwEZk0=
-github.com/hashicorp/terraform-provider-google v1.20.1-0.20230314171803-c10c326bcb26/go.mod h1:Me09EooskxD1HNA2k+14YdLghnF8lt2HOda03gBkNpc=
+github.com/hashicorp/terraform-provider-google v1.20.1-0.20230314182612-5859155c781b h1:NQSAOwdwq7rpRQtqiM0Cq8zAAUB1VN08slVBv9+KEWk=
+github.com/hashicorp/terraform-provider-google v1.20.1-0.20230314182612-5859155c781b/go.mod h1:Me09EooskxD1HNA2k+14YdLghnF8lt2HOda03gBkNpc=
 github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
 github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
 github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=


Test patch:
diff --git a/converters/google/resources/config_test_utils.go b/converters/google/resources/config_test_utils.go
index 62f3c3c5..b2332209 100644
--- a/converters/google/resources/config_test_utils.go
+++ b/converters/google/resources/config_test_utils.go
@@ -29,6 +29,7 @@ func configureTestBasePaths(c *Config, url string) {
 	c.BigQueryBasePath = url
 	c.BigqueryAnalyticsHubBasePath = url
 	c.BigqueryConnectionBasePath = url
+	c.BigqueryDatapolicyBasePath = url
 	c.BigqueryDataTransferBasePath = url
 	c.BigqueryReservationBasePath = url
 	c.BigtableBasePath = url