Dynamic database_id from Terraform to Wrangler.toml

For Workers & Pages, what is the name of the domain?

default .dev domain

What is the error number?

No error

What is the error message?

No error message

What is the issue or error you’re encountering

Deploy Worker via Terraform and use database_id dynamically

What steps have you taken to resolve the issue?

I deploy a D1 database and a worker via Terraform. They are bound (correctly) as terraform can add the binding. This shows OK in the console.
However, I can’t fully automate the deployment since the database_id is created when Terraform runs, and I need to manually copy it into my githup repo in the wrangler.toml file.
So the problem is… How can I deploy a worker where the database binding(s) comes from Terraform, and not from wrangler.toml.

What are the steps to reproduce the issue?

Possible options that would solve it: If the console’s database binding would override wrangler.toml and remove the need for the database_id alltogether. Or, if wrangler.toml could read a variable and use that as the database_id for configuration. Or an environment variable.
Note that I have no problem connecting to the D! database in my worker. This question is ENTIRELY about how to configure it in the first place.