terraform-provider-netlify
terraform-provider-netlify copied to clipboard
netlify_deploy_key.key: &{0 } (*models.Error) is not supported by the TextConsumer
Hi! I'm getting the following error when trying to apply the terraform configuration. Here is the error stack:
Error: Error applying plan:
1 error(s) occurred:
* netlify_deploy_key.key: 1 error(s) occurred:
* netlify_deploy_key.key: &{0 } (*models.Error) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
config
variable token {}
variable base_url {}
provider "netlify" {
token = "${var.token}"
base_url = "${var.base_url}"
}
provider "github" {
organization = "user"
}
resource "netlify_deploy_key" "key" {}
resource "github_repository_deploy_key" "key" {
title = "Netlify"
repository = "repo"
key = "${netlify_deploy_key.key.public_key}"
read_only = false
}
resource "github_repository_webhook" "main" {
repository = "gatsby-starter-default"
name = "web"
events = ["delete", "push", "pull_request"]
configuration {
content_type = "json"
url = "https://api.netlify.com/hooks/github"
}
depends_on = ["netlify_site.main"]
}
resource "netlify_site" "main" {
name = "testing-terraform"
repo {
provider = "github"
repo_path = "user/repo"
repo_branch = "master"
command = "yarn build"
dir = "public"
deploy_key_id = "${netlify_deploy_key.key.id}"
}
}
Have you provided your GitHub API token? I think you're getting an error back from GitHub that you aren't authenticated and that's not being handled cleanly.
I've hit this issue when I set an incorrect base_url. After removing the key altogether and using the default value this was resolved.