I am using provider.alias file to create infrastructure in different regions in AWS. I am also using a variable “region” in variables.tf file with a default value. The mentioned settings works fine for creating infrastructure in different regions. However I have a resources.tf file where the template file values are provided. This resources.tf file refers to the variables.tf file for variables and the picks up the default region rather than the provider.alias region. Is there a way where I can pass the provider region directly to the template resources?
Thanks in advance!
You should bee able to create nested TF modules that define multiple providers which would enable you to have a one-click workflow to provision your main infra, and say, DR infra in a separate region.
That said, TF workspaces are a bit cleaner and easier to reason about, especially to others who are reading your TF configs.
Are you using a build tool like Jenkins for executing the TF commands?
Thank You for looking into this. Let me share my code with you so that you get a better understanding of what I am trying to achieve. I want to use eu_west_3 region in template file but eu_central_1 is being picked from variables.tf file.