Skip to content

Changelog

New updates and improvements at Cloudflare.

Back to all posts

Manage AI Security for Apps with Terraform

You can now manage AI Security for Apps with Terraform. Version 5.29.0 of the Terraform Cloudflare provider adds two resources:

For example:

resource "cloudflare_ai_security" "zone_ai_security" {
  zone_id = var.cloudflare_zone_id
  enabled = true
}

resource "cloudflare_ai_security_custom_topics" "zone_custom_topics" {
  zone_id = var.cloudflare_zone_id

  topics = [
    {
      label = "competitors"
      topic = "seeking info on competitors"
    }
  ]
}

You can then use AI Security for Apps fields in custom rules managed with the cloudflare_ruleset resource, keeping your detection settings, topics, and mitigation rules in the same configuration.

For more examples, refer to Terraform configuration examples.