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

missing variable CLOUDFLARE_API_TOKEN #176

Closed
missteek opened this issue Oct 21, 2021 · 2 comments
Closed

missing variable CLOUDFLARE_API_TOKEN #176

missteek opened this issue Oct 21, 2021 · 2 comments

Comments

@missteek
Copy link

Hello there,

Great guide only missing important info about the API token creation, just spent a good 24 hours trying to get this to work - hope this helps others avoid the same pain!

  1. create API token following the instructions from here:
  1. From the Hashicorp guide:
  • Create an environment variable named CLOUDFLARE_API_TOKEN and set it to your Cloudflare API token.
    $ export CLOUDFLARE_API_TOKEN=Oo-bF...
  1. On the container the following variables are required:
export TF_VAR_dns_domain=example.com
export TF_VAR_dns_zone_id=myzoneid
export HCLOUD_TOKEN=my hetzner cloud_token
export CLOUDFLARE_EMAIL=user@example.com
export CLOUDFLARE_API_KEY=cloudflare GLOBAL api key
  1. This addittional variable is required:
export CLOUDFLARE_API_TOKEN=Oo-bF...
  1. If you don't export the CLOUDFLARE_API_TOKEN variable, the Cloudflare API does not create DNS records and you get the following when running make infrastructure BOOTSTRAP=true
Error: failed to create DNS record: error from makeRequest: HTTP status 403: Authentication error
 
   with cloudflare_record.dns_a_apps_wc,
   on dns.tf line 34, in resource "cloudflare_record" "dns_a_apps_wc":
   34: resource "cloudflare_record" "dns_a_apps_wc" {

Thank you

@slauger
Copy link
Owner

slauger commented Oct 25, 2021

Thank you for the feedback! Yes, the API Tokens for the CloudFlare API are a bit confusing - especially the global API key. I added a link to this issue in the README.md for new users.

The general documentation for the Cloudflare provider can be found here btw:

https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs#api_token

@missteek
Copy link
Author

Thanks for the info and update to the README.

@slauger slauger closed this as completed Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants