Terraform traffic manager for multiple environments

Hello,

We are using Terraform to configure the Azure Traffic Manager. Current folder structure is

<>
main.tf
var.tf
region1.tf
region2.tf

I also use Azure CI/CD pipeline for automation. If I want to have the same thing for both test and prod but with different endpoints, is my option to use workspace? Are there other ways to do it? By doing so, how do I automatically choose to deploy to an environment based on the changes made to the configs?