Custom domain for worker using wrangler.toml is not working

I’m trying to add a custom domain for my worker.

Trying from dashboard works fine, I create a custom domain on worker and a DNS entry also gets created.

But when I try to do the same using wrangler.toml as source of truth, it won’t create a DNS record and it’s not working.

Is this line all I need regarding custom domain? doesn’t route and won’t work.

route = { pattern = “sub.mydomain.io”, custom_domain = true }