terraform-provider-netlify icon indicating copy to clipboard operation
terraform-provider-netlify copied to clipboard

(*models.Error) is not supported by the TextConsumer, data field should be optional in webhooks

Open tprasadtp opened this issue 5 years ago • 0 comments

# Configure the Netlify Provider
provider "netlify" {
  token = "NETLIFY_TOKEN"
}

terraform {
  required_version = ">= 0.12.20"
}


// How do I know about events and Event Types?
// curl -sSfL -H "Authorization: Bearer ${NETLIFY_TOKEN}" https://api.netlify.com/api/v1/hooks/types | jq

resource "netlify_hook" "commit_status" {

  site_id = "SITE_ID"
  type    = "github_app_commit_status"
  event   = "github_app_checks"

  data = { }
}

The above config will fail with error

2020-02-23T15:19:28.196+0100 [DEBUG] plugin: using plugin: version=5
2020/02/23 15:19:28 [WARN] Provider "registry.terraform.io/-/netlify" produced an invalid plan for netlify_hook.commit_status, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .data: planned value cty.NullVal(cty.Map(cty.String)) does not match config value cty.MapVal(map[string]cty.Value{"message":cty.NullVal(cty.String)})
netlify_hook.commit_status: Creating...
2020/02/23 15:19:28 [DEBUG] netlify_hook.commit_status: applying the planned Create change
2020/02/23 15:19:28 [DEBUG] netlify_hook.commit_status: apply errored, but we're indicating that via the Error pointer rather than returning it: &{0 } (*models.Error) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface
2020/02/23 15:19:28 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: &{0 } (*models.Error) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface
2020/02/23 15:19:28 [ERROR] <root>: eval: *terraform.EvalSequence, err: &{0 } (*models.Error) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface

Error: &{0 } (*models.Error) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface

  on main.tf line 5, in resource "netlify_hook" "commit_status":
   5: resource "netlify_hook" "commit_status" {


2020-02-23T15:19:28.530+0100 [DEBUG] plugin: plugin process exited: path=/home/prasad/Git/infra/netlify/test/.terraform/plugins/linux_amd64/terraform-provider-netlify_v0.4.0_x4 pid=8908
2020-02-23T15:19:28.530+0100 [DEBUG] plugin: plugin exited


Also data fields are optional in some cases, eg. for hook_type github_app_checks there are no fields

  {
    "name": "github_app_checks",
    "fields": [],
    "events": [
      "deploy_building",
      "deploy_created",
      "deploy_failed"
    ]
  },

tprasadtp avatar Feb 23 '20 14:02 tprasadtp