Use terraform to create your worker or pages project and use it to configure and setup env vars and
Use terraform to create your worker or pages project and use it to configure and setup env vars and secrets. And then only use wrangler to deploy code 



