-
Notifications
You must be signed in to change notification settings - Fork 759
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.version/5Categorizes issue or PR as related to version 5 of the provider.Categorizes issue or PR as related to version 5 of the provider.
Description
Confirmation
- This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
- I have searched the issue tracker and my issue isn't already found.
- I have replicated my issue using the latest version of the provider and it is still present.
Terraform and Cloudflare provider version
$ ./terraform -v
Terraform v1.13.4
on linux_amd64
+ provider registry.terraform.io/cloudflare/cloudflare v5.12.0 Affected resource(s)
- data.cloudflare_account
Terraform configuration files
data "cloudflare_account" "this" {
account_id="<retracted>"
# filter = {
# name = "<retracted name>"
# }
}
output "test" {
value = "account ${data.cloudflare_account.this.id}"
}Link to debug output
n/a
Panic output
No response
Expected output
test = "account <retracted>"
Actual output
data.cloudflare_account.this: Reading...
data.cloudflare_account.this: Read complete after 1s
╷
│ Error: Invalid template interpolation value
│
│ on bug.tf line 20, in output "test":
│ 20: value = "account ${data.cloudflare_account.this.id}"
│ ├────────────────
│ │ data.cloudflare_account.this.id is null
│
│ The expression result is null. Cannot include a null value in a string
│ template.
╵
Steps to reproduce
Create an Account Token
Run terraform apply on this file:
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 5.12.0"
}
}
}
provider "cloudflare" {}
data "cloudflare_account" "this" {
account_id="<retracted>"
# filter = {
# name = "<retracted name>"
# }
}
output "test" {
value = "account ${data.cloudflare_account.this.id}"
}Additional factoids
As mentioned, I'm using an Account Token to run terraform... I've tried with restricting it to "Account Read" access to "Access Organization, identity Providers, Groups", then ultimately gave it read access to all Account fields. The result is the same: the account_id is always null. I've also tried to use the filter feature, it also didn't help.
My intention was to use data.cloudflare_account (or even data.cloudflare_accounts) to "self-discover" the account_id based on the Account Token used. Thus, ideally, I'd have:
data "cloudflare_account" "this" {}
resource "cloudflare_r2_bucket" "bucket" {
account_id = data.cloudflare_account.this.id
...
}References
nikitabarskov
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.version/5Categorizes issue or PR as related to version 5 of the provider.Categorizes issue or PR as related to version 5 of the provider.