# Terraform plan and providers usage

**URL:** <https://discuss.hashicorp.com/t/terraform-plan-and-providers-usage/32126>\
**Category:** Terraform\
**Created:** [November 18, 2021, 3:55pm UTC](https://discuss.hashicorp.com/t/terraform-plan-and-providers-usage/32126 "2021-11-18T15:55:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![psiservices-ian-kost](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/psiservices-ian-kost/32/23848_2.png) [@psiservices-ian-kost](https://discuss.hashicorp.com/u/psiservices-ian-kost)\
**Post date:** [November 18, 2021, 3:55pm UTC](https://discuss.hashicorp.com/t/terraform-plan-and-providers-usage/32126/1 "2021-11-18T15:55:16Z")

</div>

Scenario:  
I have a region, us-west-2, and I have created an sqs queue called sqs\_results\_us using terraform. I now want to add an additional region, eu-west-2, and create a different sqs queue there, lets call it sqs\_results\_eu.

My main.tf for my root module contains these providers now:  
provider “aws” {  
region = “us-east-1”  
}  
provider “aws” {  
alias = “eu\_west\_2”  
region = “eu-west-2”  
}  
provider “aws” {  
alias = “us\_west\_2”  
region = “us-west-2”  
}

I also have an SQS module that looks like this:  
module “sqs\_queues”{  
source = “…/common/sqs”  
providers = {  
aws-eu = aws.eu\_west\_2  
aws-us = aws.us\_west\_2  
}  
}  
In my sqs module folder I have a providers.tf that looks like this:  
terraform {  
required\_providers {  
aws-us = {  
source = “aws”  
version = “\>= 2.51.0”  
}  
aws-eu = {  
source = “aws”  
version = “\>= 2.51.0”  
}  
}  
}

In my sqs module folder I have 2 files, main\_us.tf and main\_eu.tf to create sqs queues in respective regions. The sqs queue in the us region (main\_us.tf):  
resource “aws\_sqs\_queue” “sqs\_results\_us” {  
name = “results-us”  
delay\_seconds = 0  
max\_message\_size = 262144  
message\_retention\_seconds = 345600  
receive\_wait\_time\_seconds = 0  
visibility\_timeout\_seconds = 30  
provider = aws-us  
}  
After adding in the code to create queues for the eu-west-2 region my terraform plan says that the US queue still needs to be created even though I just created it. I did enable TF\_LOG=trace and noticed that the provider was getting set to the first region listed in providers {} of the sqs module and not utilizing the provider of the resource:  
2021-11-17T16:02:01.942-0600 [TRACE] vertex "provider["[registry.terraform.io/hashicorp/aws"].eu\_west\_2"](http://registry.terraform.io/hashicorp/aws%22%5D.eu_west_2%22)  
If I swap the positions of the providers so the US provider is first then the “add” goes away because its now setting to the us-west-2 region, so it finds the resource already created.

Am I doing something wrong with how I am passing down my providers to modules/resources? Is this a bug or a limitation and I would have to create a 2nd module and split out the providers so there is only 1 provider being passed down to resources?

I am using terraform 1.0.6 version.
