Terraform-provider-cloudflare: After upgrade to version 2.0.0 of provider started to get Invalid format for Authorization header

Created on 1 Oct 2019  路  5Comments  路  Source: cloudflare/terraform-provider-cloudflare

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

  • provider.aws v2.30.0
  • provider.cloudflare v2.0.0
  • provider.template v2.1.2

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.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nmishin picture Nmishin  路  7Comments

hashibot picture hashibot  路  5Comments

jacobbednarz picture jacobbednarz  路  5Comments

prdonahue picture prdonahue  路  4Comments

brucedvgw picture brucedvgw  路  3Comments