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

Terraform plan crashes: interface conversion: interface {} is string, not map[string]interface {} #9230

Closed
Assignees
Labels

Comments

@KevinDukelow5
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

15.4

Affected Resource(s)

All resources, plans and applies will not run

  • google_XXXXX

Terraform Configuration Files

# Copy-paste your Terraform configurations here.
#
# For large Terraform configs, please use a service like Dropbox and share a link to the ZIP file.
# For security, you can also encrypt the files using our GPG public key:
#    https://www.hashicorp.com/security
#
# If reproducing the bug involves modifying the config file (e.g., apply a config,
# change a value, apply the config again, see the bug), then please include both:
# * the version of the config before the change, and
# * the version of the config after the change.

Debug Output

Panic Output

│ Error: Request cancelled

│ with google_bigquery_table.US_Base_Data_Whse_Master_view,
│ on wrl_us_base_data_whse_master.tf line 78, in resource "google_bigquery_table" "US_Base_Data_Whse_Master_view":
│ 78: resource "google_bigquery_table" "US_Base_Data_Whse_Master_view" {

│ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.


│ Error: Request cancelled

│ with google_bigquery_table.US_Sams_Base_Data_Weekly_POS_view,
│ on wrl_us_sams_base_data_pos.tf line 62, in resource "google_bigquery_table" "US_Sams_Base_Data_Weekly_POS_view":
│ 62: resource "google_bigquery_table" "US_Sams_Base_Data_Weekly_POS_view" {

│ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.


│ Error: Request cancelled

│ with google_bigquery_table.USA_Samsclub_Base_Data_Product_Master_view,
│ on wrl_usa_samsclub_base_product_master_bq.tf line 427, in resource "google_bigquery_table" "USA_Samsclub_Base_Data_Product_Master_view":
│ 427: resource "google_bigquery_table" "USA_Samsclub_Base_Data_Product_Master_view" {

│ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.

Stack trace from the terraform-provider-google_v3.68.0_x5 plugin:

panic: interface conversion: interface {} is string, not map[string]interface {}

goroutine 21779 [running]:
github.com/hashicorp/terraform-provider-google/google.bigQueryTablecheckNameExists(0xc000ce4300, 0x1, 0x1, 0x418377, 0x8)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_bigquery_table.go:35 +0x16d
github.com/hashicorp/terraform-provider-google/google.jsonCompareWithMapKeyOverride(0x267c920, 0xc000ce2948, 0x267c920, 0xc000ce2990, 0x2e341c0, 0xc000ff4d01, 0x26b4620, 0xc000d9f270)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_bigquery_table.go:56 +0x668
github.com/hashicorp/terraform-provider-google/google.jsonCompareWithMapKeyOverride(0x288fb80, 0xc000f225d0, 0x288fb80, 0xc000f22cc0, 0x2e341c0, 0x1, 0x0, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_bigquery_table.go:96 +0x3f6
github.com/hashicorp/terraform-provider-google/google.jsonCompareWithMapKeyOverride(0x288fb80, 0xc000f225a0, 0x288fb80, 0xc000f22c90, 0x2e341c0, 0xc000d9ffe0, 0x194, 0x267c920)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_bigquery_table.go:96 +0x3f6
github.com/hashicorp/terraform-provider-google/google.jsonCompareWithMapKeyOverride(0x267c920, 0xc000ce2960, 0x267c920, 0xc000ce29a8, 0x2e341c0, 0x0, 0x0, 0xc000d9e990)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_bigquery_table.go:65 +0x779
github.com/hashicorp/terraform-provider-google/google.bigQueryTableSchemaDiffSuppress(0x2cfe154, 0x6, 0xc000f0ed00, 0x8b8, 0xc0000ef200, 0x8b8, 0xc000d78d80, 0x203000)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/resource_bigquery_table.go:156 +0x26f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0xc0005a58c0, 0x2cfe154, 0x6, 0xc000147040, 0xc000e2b080, 0x31d2a28, 0xc000d78d80, 0xc000fbba00, 0x0, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:972 +0x383
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc0005a58c0, 0x31a3140, 0xc000f64840, 0xc000fb9a40, 0xc00130c7e0, 0xc000078a20, 0x2cd8c00, 0xc0002d5800, 0x3fcf500, 0x26b4620, ...)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:522 +0x219
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0xc000090700, 0x31a3140, 0xc000f64840, 0xc000fb9a40, 0xc00130c7e0, 0x2cd8c00, 0xc0002d5800, 0x0, 0x0, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:506 +0xa5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc0000af710, 0x31a3140, 0xc000f64840, 0xc000bd7450, 0xc000f64840, 0x2c2c320, 0xc0011ade00)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:693 +0x7c5
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).PlanResourceChange(0xc000e2be20, 0x31a31e8, 0xc000f64840, 0xc000fb9960, 0xc000e2be20, 0xc0011ade60, 0xc000cf3ba0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/server/server.go:315 +0xb5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler(0x2c2c320, 0xc000e2be20, 0x31a31e8, 0xc0011ade60, 0xc000fde120, 0x0, 0x31a31e8, 0xc0011ade60, 0xc000d08000, 0x29ae)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:362 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003a7500, 0x31dae98, 0xc0000bf680, 0xc000e7d100, 0xc0005a5e60, 0x3f8b448, 0x0, 0x0, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:1217 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0003a7500, 0x31dae98, 0xc0000bf680, 0xc000e7d100, 0x0)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:1540 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0005a2220, 0xc0003a7500, 0x31dae98, 0xc0000bf680, 0xc000e7d100)
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:878 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/[email protected]/server.go:876 +0x1fd

Error: The terraform-provider-google_v3.68.0_x5 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@KevinDukelow5
Copy link
Author

The issue is caused by the following TF file:

resource "google_bigquery_table" "chewy_hin_hills_weekly_data" {
  table_id   = "chewy_hin_hills_weekly_data"
  dataset_id = "chewy"
  deletion_protection = false
  schema = <<SCHEMA
[
  {
    "mode": "NULLABLE",
    "name": "chewy_unique_key",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "orderdate",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "shipdate",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "customerid",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "hin",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "providername",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "providerstreet1",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "providercity",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "providerstate",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "providerpostcode",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "providerphone",
    "type": "STRING",
    "policyTags": {
          "names": ["${google_data_catalog_policy_tag.basic_policy_tag_high.id}"]
        }
  },
  {
    "mode": "NULLABLE",
    "name": "approvername",
    "type": "STRING",
    "policyTags": {
          "names": ["${google_data_catalog_policy_tag.basic_policy_tag_high.id}"]
        }
  },
  {
    "mode": "NULLABLE",
    "name": "partnumber",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "mfpartnumber",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "manufacturername",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "gtin",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "name",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "productuom",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "packagedweight",
    "type": "FLOAT"
  },
  {
    "mode": "NULLABLE",
    "name": "quantity",
    "type": "INTEGER"
  },
  {
    "mode": "NULLABLE",
    "name": "price",
    "type": "FLOAT"
  },
  {
    "mode": "NULLABLE",
    "name": "refillsallowed",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "expiration",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "fullname",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "customer_address_street1",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "customer_address_city",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "customer_address_state",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "customer_address_zip",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "report_type",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "start_date",
    "type": "DATE"
  },
  {
    "mode": "NULLABLE",
    "name": "end_date",
    "type": "DATE"
  },
  {
    "mode": "NULLABLE",
    "name": "snapshot_date",
    "type": "TIMESTAMP"
  },
  {
    "mode": "NULLABLE",
    "name": "dag_id",
    "type": "STRING"
  },
  {
    "mode": "NULLABLE",
    "name": "run_id",
    "type": "STRING"
  }
]
SCHEMA

  time_partitioning {
    field = "snapshot_date"
    type  = "DAY"
  }

  lifecycle {
    ignore_changes = [
      labels
    ]
    prevent_destroy = false
  }

  depends_on = [
    google_data_catalog_policy_tag.basic_policy_tag_high
  ]
}

resource "google_bigquery_table" "chewy_hin_hills_weekly_data_base_view" {
  table_id   = "chewy_hin_hills_weekly_data_base_view"
  dataset_id = google_bigquery_table.chewy_hin_hills_weekly_data.dataset_id
  deletion_protection = false
  view {
    query          = <<SQL
select chewy_unique_key,
       PARSE_DATE("%Y%m%d", orderdate) as orderdate,
       PARSE_DATE("%Y%m%d", shipdate) as shipdate,
       customerid,
       hin,
       providername,
       providerstreet1,
       providercity,
       providerstate,
       providerpostcode,
       providerphone,
       approvername,
       partnumber,
       mfpartnumber,
       manufacturername,
       gtin,
       name,
       productuom,
       packagedweight,
       quantity,
       price,
       refillsallowed,
       expiration,
       fullname,
       customer_address_street1,
       customer_address_city,
       customer_address_state,
       customer_address_zip,
       report_type,
       start_date,
       end_date
from (
  select *, RANK()
  over(partition by start_date order by snapshot_date desc) as rn
from `${var.project_id}.${google_bigquery_table.chewy_hin_hills_weekly_data.dataset_id}.${google_bigquery_table.chewy_hin_hills_weekly_data.table_id}`
) where rn = 1
SQL
    use_legacy_sql = false
  }

  labels = {
    env = var.env
  }
    lifecycle {
    ignore_changes = [
      labels
    ]
    prevent_destroy = false
  }
}

@KevinDukelow5
Copy link
Author

This is the relevant state entry:

{
      "mode": "managed",
      "type": "google_bigquery_table",
      "name": "chewy_hin_hills_weekly_data",
      "provider": "provider[\"registry.terraform.io/hashicorp/google\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "clustering": null,
            "creation_time": 1620762122655,
            "dataset_id": "chewy",
            "deletion_protection": false,
            "description": "",
            "encryption_configuration": [],
            "etag": "vy3DIxGKWs0tJHKBxX0QeA==",
            "expiration_time": 0,
            "external_data_configuration": [],
            "friendly_name": "",
            "id": "projects/cp-saa-external-sales-dev/datasets/chewy/tables/chewy_hin_hills_weekly_data",
            "labels": {
              "dag_id": "chewyhinhillsweeklyloadtobqdag",
              "run_id": "manual20210518t0556000000"
            },
            "last_modified_time": 1621336697645,
            "location": "US",
            "materialized_view": [],
            "num_bytes": 264822228,
            "num_long_term_bytes": 0,
            "num_rows": 561528,
            "project": "cp-saa-external-sales-dev",
            "range_partitioning": [],
            "schema": "[{\"mode\":\"NULLABLE\",\"name\":\"chewy_unique_key\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"orderdate\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"shipdate\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"customerid\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"hin\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"providername\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"providerstreet1\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"providercity\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"providerstate\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"providerpostcode\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"providerphone\",\"policyTags\":{\"names\":[\"projects/cp-saa-external-sales-dev/locations/us/taxonomies/3213390555740484822/policyTags/1541206738524260534\"]},\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"approvername\",\"policyTags\":{\"names\":[\"projects/cp-saa-external-sales-dev/locations/us/taxonomies/3213390555740484822/policyTags/1541206738524260534\"]},\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"mfpartnumber\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"manufacturername\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"gtin\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"name\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"productuom\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"packagedweight\",\"type\":\"FLOAT\"},{\"mode\":\"NULLABLE\",\"name\":\"quantity\",\"type\":\"INTEGER\"},{\"mode\":\"NULLABLE\",\"name\":\"price\",\"type\":\"FLOAT\"},{\"mode\":\"NULLABLE\",\"name\":\"refillsallowed\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"expiration\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"customer_address_city\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"customer_address_state\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"customer_address_zip\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"report_type\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"start_date\",\"type\":\"DATE\"},{\"mode\":\"NULLABLE\",\"name\":\"end_date\",\"type\":\"DATE\"},{\"mode\":\"NULLABLE\",\"name\":\"snapshot_date\",\"type\":\"TIMESTAMP\"},{\"mode\":\"NULLABLE\",\"name\":\"dag_id\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"run_id\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"partnumber\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"fullname\",\"type\":\"STRING\"},{\"mode\":\"NULLABLE\",\"name\":\"customer_address_street1\",\"type\":\"STRING\"}]",
            "self_link": "https://bigquery.googleapis.com/bigquery/v2/projects/cp-saa-external-sales-dev/datasets/chewy/tables/chewy_hin_hills_weekly_data",
            "table_id": "chewy_hin_hills_weekly_data",
            "time_partitioning": [
              {
                "expiration_ms": 0,
                "field": "snapshot_date",
                "require_partition_filter": false,
                "type": "DAY"
              }
            ],
            "type": "TABLE",
            "view": []
          },
          "sensitive_attributes": [],
          "private": "******",
          "dependencies": [
            "google_data_catalog_policy_tag.basic_policy_tag_high"
          ]
        }
      ]
    },

@KevinDukelow5
Copy link
Author

From what I understand this bug is occurring when reading the state file for the associated resources.

@github-actions
Copy link

github-actions bot commented Jul 5, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.