Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use provider with api_user_service_key #1939

Closed
2 tasks done
mattmichal opened this issue Sep 29, 2022 · 2 comments
Closed
2 tasks done

Unable to use provider with api_user_service_key #1939

mattmichal opened this issue Sep 29, 2022 · 2 comments
Labels
triage/duplicate Indicates an issue is a duplicate of other open issue.

Comments

@mattmichal
Copy link

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform v1.2.9
on linux_amd64

registry.terraform.io/cloudflare/cloudflare v3.24.0

Affected resource(s)

  • cloudflare_origin_ca_certificate

Terraform configuration files

# CLOUDFLARE_API_USER_SERVICE_KEY environment variable is given

terraform {
  required_version = "1.2.9"

  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "3.24"
    }
  }
}

provider "cloudflare" {}

data "cloudflare_ip_ranges" "ips" {}

output "cloudflare_ip_cidrs" {
  value = data.cloudflare_ip_ranges.ips.cidr_blocks
}

Link to debug output

https://gist.github.com/mattmichal/7076354c10e4ae56c1524c4223a56ba7

Panic output

No response

Expected output

Provider is configured and data calls can be executed.

Actual output

** CLOUDFLARE_API_USER_SERVICE_KEY only
│ Error: error creating new Cloudflare client: invalid credentials: key & email must not be empty
│ 
│   with provider["registry.terraform.io/cloudflare/cloudflare"],
│   on providers.tf line 18, in provider "cloudflare":
│   18: provider "cloudflare" {}

Steps to reproduce

  1. Set CLOUDFLARE_API_USER_SERVICE_KEY environment variable
  2. Add cloudflare provider to a project
  3. Execute plan operation

Additional factoids

My initial error was due to configuring both CLOUDFLARE_API_TOKEN and CLOUDFLARE_API_USER_SERVICE_KEY variables. An error is returned as expected due to the changes in #1907.

** CLOUDFLARE_API_TOKEN and CLOUDFLARE_API_USER_SERVICE_KEY
│ Error: Invalid combination of arguments
│ 
│   with provider["registry.terraform.io/cloudflare/cloudflare"],
│   on providers.tf line 13, in provider "cloudflare":
│   13: provider "cloudflare" {}
│ 
│ "api_token": only one of `api_key,api_token,api_user_service_key` can be
│ specified, but `api_token,api_user_service_key` were specified.

After seeing that PR and the 3.24.0 release notes, I removed the API token because the user service key is required in my production project due to references to cloudflare_origin_ca_certificate resources.

References

No response

@mattmichal mattmichal added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 29, 2022
@jacobbednarz
Copy link
Member

this has already been addressed in #1923 and slated for the next release. if you'd like to use it now, you can build an unreleased version to use.

@jacobbednarz jacobbednarz closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2022
@jacobbednarz jacobbednarz added triage/duplicate Indicates an issue is a duplicate of other open issue. and removed kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 29, 2022
@mattmichal
Copy link
Author

I confirmed that #1919 describes the same issue. It seems like I searched open issues and not closed issues when looking for existing reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/duplicate Indicates an issue is a duplicate of other open issue.
Projects
None yet
Development

No branches or pull requests

2 participants