cloudflare_pages_domain
resource not found upon terraform state refresh after successful apply
#4901
Open
3 tasks done
Labels
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.
triage/debug-log-attached
Indicates an issue or PR has a complete Terraform debug log.
Confirmation
Terraform and Cloudflare provider version
Affected resource(s)
cloudflare_pages_domain
Terraform configuration files
Link to debug output
https://gist.github.com/quiqueg/c7e7dc9a64e79bd9476c3d0757d9531b
Panic output
No response
Expected output
Expected
tf plan
output:Actual output
Actual
tf plan
output:Steps to reproduce
cloudflare_pages_domain
withtf apply
tf plan
Additional factoids
From looking at the debug output, it seems that when there is a
cloudflare_pages_domain
in the state, when the provider refreshes the state, it tries to get the existing domain data from the CloudFlare API by hitting the following URL:GET /client/v4/accounts/redacted-cf-account-id/pages/projects/redacted-pages-project/domains/6f3098f3-48a1-400f-af47-a2c187b51a6c
Note that the last URL path segment is
6f3098f3-48a1-400f-af47-a2c187b51a6c
, which matches theid
of the CF Pages domain.However, per the CloudFlare API documentation for "Get domain", the URL path should be of the form:
/accounts/{account_id}/pages/projects/{project_name}/domains/{domain_name}
where the last URL path segment is expected to be the CF Pages domain
name
, not theid
.I've confirmed this expectation by
curl
ing the CloudFlare API directly.id
, we get a 404 response:name
, we get a 200 response:Here's my
tf state show
output:I also tried removing the resource from my terraform state and importing it instead, but ran into a similar issue:
I've captured the debug output from
tf import ...
and added it to atf-import.log
file in the gist linked above.References
N/A
The text was updated successfully, but these errors were encountered: