首页 > 解决方案 > Terraform 提供者 restapi:我如何忽略阅读响应

问题描述

我正在对不返回任何响应正文的 api 执行 PUT/POST。在这种情况下,terraform 总是会抛出以下错误,因为响应正文是空的。

我正在使用terraform-provider-restapislack进行 PUT/POST 调用。这是我的提供商配置。

provider "restapi" {
  update_method = "PUT"
  id_attribute = "username"
  write_returns_object = false
  uri = "https://hooks.slack.com/services"
  headers = {
    "Accept" = "text/plain"
    "Content-Type" = "application/json"
  }
}

由于 slack rest 调用返回任何内容,并且terraform-provider-restapi正在尝试读取响应,最终引发以下错误。

unexpected end of JSON input

我想忽略阅读terraform-provider-restapi的响应。有什么选择吗?

标签: terraform

解决方案


推荐阅读