terraform-provider-cloudflare
terraform-provider-cloudflare copied to clipboard
Support for cloudflare_teams_list as a data source to obtain uuid
Current Terraform and Cloudflare provider version
Terraform v1.2.8 provider registry.terraform.io/cloudflare/cloudflare v3.23.0
Description
I would like to obtain cloudflare_teams_list from a data source to support creation of policies based on teams_list id. I can statically define the uuid but would be nice to have the ability to programmatically lookup in terraform.
Use cases
This request would allow the programmatic capability to retrieve the teams list uuid for use in other areas of code. the specific use case would be to enable the creation of a policy to include a list within a DNS policy. see: https://developers.cloudflare.com/cloudflare-one/policies/filtering/dns-policies/#operators Use this selector to apply DNS policies based on a user configurable list. UI name API example traffic: "any(dns.domains[*] in list_name",
Potential Terraform configuration
data "cloudflare_teams_list" "this" {
name = "mylist"
}
resource "cloudflare_teams_rule" "this" {
name = "Block based on list"
account_id = var.myaccount_id
description = "Block block based on list: mylist"
enabled = true
precedence = 100
action = "block"
filters = ["dns"]
traffic = "any(dns.domains[*] in ${data.cloudflare_teams_list.this}"
rule_settings {
block_page_enabled = true
block_page_reason = "access not permitted"
}
}
References
https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/teams_list https://developers.cloudflare.com/cloudflare-one/policies/filtering/dns-policies/#operators
I'm creating the lists separatedly from policies. It'd be very useful to have a way to retrieve the id as data source. +1 for this requests.
This issue has been closed as we are now tracking this internally with service teams directly. If you would like an update or to be notified when/if the product ships with this change, please reach out to Cloudflare Support or your account team who can watch the internal feature request for you.