Cloudflare Provider: Terraform failed to create ruleset as a similar configuration already exists

I have deployed a Cloudflare ruleset(it has a confusing name “Cloudflare managed ruleset”) using Terraform. When I tried to use Terraform to deploy another ruleset(named “OWASP ruleset”), Terraform complains that

Error: failed to create ruleset xxx" as a similar configuration already exists. If you are migrating from the Dashboard, you will need to first manually remove it using the API (https://api.cloudflare.com/#zone-rulesets-delete-zone-ruleset) before you can configure it in Terraform. Otherwise, you have hit the entitlements quota and should contact your account team.

Does this mean Terraform only allows to create one “cloudflare_ruleset” resource? It is also very confusing to the mapping between “cloudflare_ruleset” resource to Cloudflare dashboard and its API.

2 Likes

I’m facing the same issue.
The error mentions " If you are migrating from the Dashboard, you will need to first remove the existing rules otherwise you can remove the existing phase yourself using the API " but this is not my case, as the rules where created by Terraform only.