Deploy: fails at "Download Terraform state"
Environment: Following deployment instructions provided by Cloudflare without changes.
Expected behavior: Deployment script completes.
Actual behavior: At the "download Terraform state" step, I am receiving an error "Failed to fetch https://api.cloudflare.com/client/v4/accounts//storage/kv/namespaces/750f32f1b078482f80f301a1a4094b76/values/terraform.tfstate - 404: Not Found);" If I visit this URL, substituting in my account ID for "", I see a status page with the message "Missing X-Auth-Key, X-Auth-Email or Authorization headers." The deploy script then fails.
I have same issue. In my case, this step was success some times. After resolving another issues which caused at after steps, then this happned.
I had a few failures before this one, but they were all easily resolved based on the errors. I've rerun the script a couple of times and this doesn't resolve itself.
For completeness, I did test the API key after I created it and it is working.
roughly the same issue, but different URL:
✘ [ERROR] Failed to fetch https://api.cloudflare.com/client/v4/accounts/***/storage/kv/namespaces/c3ac9ed9fff1419ca07d1783240a44e3/values/terraform.tfstate - 404: Not Found);
I could fix this issue by deleting KV namespace. This is written in this issue thread
But there is still another issues in my case.

2023-02-12T02:56:03.9507333Z [31m│[0m [0m[1m[31mError: [0m[0m[1mexpected DNS record to not already be present but already exists[0m
2023-02-12T02:56:03.9573484Z [31m│[0m [0m
2023-02-12T02:56:03.9583821Z [31m│[0m [0m[0m with cloudflare_record.record,
2023-02-12T02:56:03.9584394Z [31m│[0m [0m on main.tf line 145, in resource "cloudflare_record" "record":
2023-02-12T02:56:03.9585004Z [31m│[0m [0m 145: resource "cloudflare_record" "record" [4m{[0m[0m
2023-02-12T02:56:03.9585591Z [31m│[0m [0m
2023-02-12T02:56:03.9585897Z [31m╵[0m[0m
2023-02-12T02:56:03.9625339Z ##[error]Terraform exited with code 1.
2023-02-12T02:56:03.9650715Z ##[error]Process completed with exit code 1.
It may caused because I try to reuse my root domain.
I had that same error and solved it by deleting the A record for the root domain (which I'd accidentally left over from another attempt to set up Mastodon using a different platform).
On Sat, Feb 11, 2023 at 10:04 PM TenTakano @.***> wrote:
I could fix this issue by deleting KV namespace. This is written in this issue thread https://github.com/cloudflare/wildebeest/issues/227#issuecomment-1424154781
But there is still another issues in my case.
[image: image] https://user-images.githubusercontent.com/19324039/218290539-bfc759ba-0905-45e7-bd59-3b820174fcaa.png
2023-02-12T02:56:03.9507333Z �[31m│�[0m �[0m�[1m�[31mError: �[0m�[0m�[1mexpected DNS record to not already be present but already exists�[0m
2023-02-12T02:56:03.9573484Z �[31m│�[0m �[0m
2023-02-12T02:56:03.9583821Z �[31m│�[0m �[0m�[0m with cloudflare_record.record,
2023-02-12T02:56:03.9584394Z �[31m│�[0m �[0m on main.tf line 145, in resource "cloudflare_record" "record":
2023-02-12T02:56:03.9585004Z �[31m│�[0m �[0m 145: resource "cloudflare_record" "record" �[4m{�[0m�[0m
2023-02-12T02:56:03.9585591Z �[31m│�[0m �[0m
2023-02-12T02:56:03.9585897Z �[31m╵�[0m�[0m
2023-02-12T02:56:03.9625339Z ##[error]Terraform exited with code 1.
2023-02-12T02:56:03.9650715Z ##[error]Process completed with exit code 1.
It may caused because I try to reuse my root domain.
— Reply to this email directly, view it on GitHub https://github.com/cloudflare/wildebeest/issues/263#issuecomment-1426930375, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATWGBHI4YF3JPBK3ZX7KPWDWXBHNHANCNFSM6AAAAAAUY4L2CI . You are receiving this because you authored the thread.Message ID: @.***>
I replaced domain name with some sub domain and resolved some issues reported this thread, then everything worked well (:
going back through "Troubleshooting \ Starting over" and removing everything from previous runs worked for me.
@crawfordlong sounds like your issue has been solved since. Feel free to reopen the issue if needed