Can't add account_id
to a cloudflare_byo_ip_prefix
#1606
Labels
kind/bug
Categorizes issue or PR as related to a bug.
triage/needs-information
Indicates an issue needs more information in order to work on it.
Confirmation
Terraform and Cloudflare provider version
1.0.11
Affected resource(s)
cloudflare_byo_ip_prefix
Terraform configuration files
Debug output
Panic output
No response
Expected output
The terraform plan detects no change, because we simply configured an explicit account_id (same as the previous implicit one).
Actual output
Steps to reproduce
cloudflare_byo_ip_prefix
with a version of cloudflare provider that doesn't include this change: build(deps): bump github.com/cloudflare/cloudflare-go from 0.36.0 to 0.37.0 #15632- Update the cloudflare provider version to the current latest one (3.14)
3- Add an
account_id
field tocloudflare_byo_ip_prefix
and set it to the correct value.terraform plan
will failAdditional factoids
Not super familiar with terraform so I don't know what the proper fix should be here. By debugging locally, I noticed that the ReadContext function of the resource doesn't receive the "desired state" as the second argument, but rather the current stored state (which doesn't include an account_id, causing the API path to be incomplete,
/accounts/addressing/prefixes/<prefix-id>
instead of/accounts/<account_id>/addressing/prefixes/<prefix-id>
):terraform-provider-cloudflare/cloudflare/resource_cloudflare_byo_ip_prefix.go
Line 46 in 285233c
Is that expected? A workaround I thought of but haven't tested would be to use
terraform state pull
to pull the current resource state, update the state file to add theaccount_id
property on ourcloudflare_byo_ip_prefix
resource, and then useterraform state push
, but that doesn't seem ideal.Also, I noticed that the
account_id
field wasn't documented publicly: https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/byo_ip_prefixReferences
I think this is happening because of #1563
The text was updated successfully, but these errors were encountered: