Hello,
After updating cloudflare provider to version 2.0.0 I started to get messages:
Error: error from makeRequest: HTTP status 400: content "{\"success\":false,\"errors\":[{\"code\":6003,\"message\":\"Invalid request headers\",\"error_chain\":[{\"code\":6111,\"message\":\"Invalid format for Authorization header\"}]}],\"messages\":[],\"result\":null}"
When I try to execute terraform plan.
I followed https://www.terraform.io/docs/providers/cloudflare/guides/version-2-upgrade.html to upgrade.
How can it be fixed?
$ terraform --version
Terraform v0.12.9
Are you using API key or API token? Could you paste your provider block (but obfuscate the secret itself)?
$ cat providers.tf
provider "cloudflare" {
version = "~> 2.0.0"
}
provider "aws" {
profile = "default"
region = "ap-southeast-1"
version = "~> 2.30.0"
}
provider "template" {
version = "~> 2.1"
}
$ echo $CLOUDFLARE_ACCOUNT_ID
my_account_id
$ echo $CLOUDFLARE_API_TOKEN
my_api_token
Ah, I think I use API key.
So with 2.0.0 I can use only API token, is it correct?
I got the issue.
Confusion appear because:
Instead of renaming CLOUDFLARE_TOKEN to CLOUDFLARE_API_TOKEN I should rename CLOUDFLARE_TOKEN to CLOUDFLARE_API_KEY.
I did it and that solved the issue.
Yup, we got the wording wrong in 1.x, and proper naming was among the changes. Glad you got it corrected eventually.
Most helpful comment
I got the issue.
Confusion appear because:
Instead of renaming CLOUDFLARE_TOKEN to CLOUDFLARE_API_TOKEN I should rename CLOUDFLARE_TOKEN to CLOUDFLARE_API_KEY.
I did it and that solved the issue.