Skip to content

Commit 7ce4e15

Browse files
authored
Remove allow_resource_tags_on_deletion from google_bigquery_table (#11393)
1 parent 974c2f9 commit 7ce4e15

File tree

4 files changed

+7
-38
lines changed

4 files changed

+7
-38
lines changed

mmv1/products/bigquery/Table.yaml

-10
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,6 @@ examples:
4343
vars:
4444
dataset_id: 'dataset_id'
4545
table_id: 'table_id'
46-
virtual_fields:
47-
- !ruby/object:Api::Type::Boolean
48-
name: 'allow_resource_tags_on_deletion'
49-
description: |
50-
If set to true, it allows table deletion when there are still resource tags attached.
51-
deprecation_message: |
52-
`allow_resource_tags_on_deletion` is deprecated and will be removed in a future major
53-
release. The default behavior will be allowing the presence of resource tags on
54-
deletion after the next major release.
55-
default_value: false
5646
parameters:
5747
# TODO(alexstephen): Remove once we have support for placing
5848
# nested object fields in URL

mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go

-22
Original file line numberDiff line numberDiff line change
@@ -1250,14 +1250,6 @@ func ResourceBigQueryTable() *schema.Resource {
12501250
Description: `Whether Terraform will be prevented from destroying the instance. When the field is set to true or unset in Terraform state, a terraform apply or terraform destroy that would delete the table will fail. When the field is set to false, deleting the table is allowed.`,
12511251
},
12521252

1253-
"allow_resource_tags_on_deletion": {
1254-
Type: schema.TypeBool,
1255-
Optional: true,
1256-
Default: false,
1257-
Description: `**Deprecated** Whether or not to allow table deletion when there are still resource tags attached.`,
1258-
Deprecated: `This field is deprecated and will be removed in a future major release. The default behavior will be allowing the presence of resource tags on deletion after the next major release.`,
1259-
},
1260-
12611253
// TableConstraints: [Optional] Defines the primary key and foreign keys.
12621254
"table_constraints": {
12631255
Type: schema.TypeList,
@@ -1930,17 +1922,6 @@ func resourceBigQueryTableDelete(d *schema.ResourceData, meta interface{}) error
19301922
if d.Get("deletion_protection").(bool) {
19311923
return fmt.Errorf("cannot destroy table %v without setting deletion_protection=false and running `terraform apply`", d.Id())
19321924
}
1933-
if v, ok := d.GetOk("resource_tags"); ok {
1934-
if !d.Get("allow_resource_tags_on_deletion").(bool) {
1935-
var resourceTags []string
1936-
1937-
for k, v := range v.(map[string]interface{}) {
1938-
resourceTags = append(resourceTags, fmt.Sprintf("%s:%s", k, v.(string)))
1939-
}
1940-
1941-
return fmt.Errorf("cannot destroy table %v without unsetting the following resource tags or setting allow_resource_tags_on_deletion=true: %v", d.Id(), resourceTags)
1942-
}
1943-
}
19441925

19451926
config := meta.(*transport_tpg.Config)
19461927
userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
@@ -2947,9 +2928,6 @@ func resourceBigQueryTableImport(d *schema.ResourceData, meta interface{}) ([]*s
29472928
if err := d.Set("deletion_protection", true); err != nil {
29482929
return nil, fmt.Errorf("Error setting deletion_protection: %s", err)
29492930
}
2950-
if err := d.Set("allow_resource_tags_on_deletion", false); err != nil {
2951-
return nil, fmt.Errorf("Error setting allow_resource_tags_on_deletion: %s", err)
2952-
}
29532931

29542932
// Replace import id for the resource id
29552933
id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}")

mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -1645,7 +1645,7 @@ func TestAccBigQueryTable_ResourceTags(t *testing.T) {
16451645
ResourceName: "google_bigquery_table.test",
16461646
ImportState: true,
16471647
ImportStateVerify: true,
1648-
ImportStateVerifyIgnore: []string{"deletion_protection", "allow_resource_tags_on_deletion"},
1648+
ImportStateVerifyIgnore: []string{"deletion_protection"},
16491649
},
16501650
{
16511651
Config: testAccBigQueryTableWithResourceTagsUpdate(context),
@@ -1654,7 +1654,7 @@ func TestAccBigQueryTable_ResourceTags(t *testing.T) {
16541654
ResourceName: "google_bigquery_table.test",
16551655
ImportState: true,
16561656
ImportStateVerify: true,
1657-
ImportStateVerifyIgnore: []string{"deletion_protection", "allow_resource_tags_on_deletion"},
1657+
ImportStateVerifyIgnore: []string{"deletion_protection"},
16581658
},
16591659
// testAccBigQueryTableWithResourceTagsDestroy must be called at the end of this test to clear the resource tag bindings of the table before deletion.
16601660
{
@@ -1664,7 +1664,7 @@ func TestAccBigQueryTable_ResourceTags(t *testing.T) {
16641664
ResourceName: "google_bigquery_table.test",
16651665
ImportState: true,
16661666
ImportStateVerify: true,
1667-
ImportStateVerifyIgnore: []string{"deletion_protection", "allow_resource_tags_on_deletion"},
1667+
ImportStateVerifyIgnore: []string{"deletion_protection"},
16681668
},
16691669
},
16701670
})
@@ -4202,7 +4202,6 @@ resource "google_bigquery_dataset" "test" {
42024202
42034203
resource "google_bigquery_table" "test" {
42044204
deletion_protection = false
4205-
allow_resource_tags_on_deletion = true
42064205
dataset_id = "${google_bigquery_dataset.test.dataset_id}"
42074206
table_id = "%{table_id}"
42084207
resource_tags = {
@@ -4240,7 +4239,6 @@ resource "google_bigquery_dataset" "test" {
42404239
42414240
resource "google_bigquery_table" "test" {
42424241
deletion_protection = false
4243-
allow_resource_tags_on_deletion = true
42444242
dataset_id = "${google_bigquery_dataset.test.dataset_id}"
42454243
table_id = "%{table_id}"
42464244
resource_tags = {
@@ -4279,7 +4277,6 @@ resource "google_bigquery_dataset" "test" {
42794277
42804278
resource "google_bigquery_table" "test" {
42814279
deletion_protection = false
4282-
allow_resource_tags_on_deletion = true
42834280
dataset_id = "${google_bigquery_dataset.test.dataset_id}"
42844281
table_id = "%{table_id}"
42854282
resource_tags = {}

mmv1/third_party/terraform/website/docs/guides/version_6_upgrade.html.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ Description of the change and how users should adjust their configuration (if ne
108108

109109
A `view` can no longer be created when `schema` contains required fields
110110

111+
### `allow_resource_tags_on_deletion` is now removed
112+
113+
Resource tags are now always allowed on table deletion.
114+
111115
## Resource: `google_bigquery_reservation`
112116

113117
### `multi_region_auxiliary` is now removed

0 commit comments

Comments
 (0)