<p>I believe you would be using multiple modules to create various resources(EC2,ELB, Etc) in AWS using Terraform. You can create a custom module having output value of each variable you want to configure per your requirement like aws-region, etc.</p>

<p>Then source(import) this custom module into your resource module and use its values using $.</p>

<p>custom_module</p>

<pre><code>output "aws_region" {
  value = "us-xyz-1"
}
output "aws_anyproperty" {
  value = "abc"
}

Add above custom_module as source in your resource module

module "custom_module" {
  source="../../../modules/custom_module"
}

provider "aws" {
  version="~&gt; y.x"
  profile="${module.custom_module.aws_anyproperty}"
  region="${module.custom_module.aws_region}"
}
</code></pre>

CC BY-SA 4.0
2019-05-30T10:53:48.390Z
2019-05-31T07:45:12.493Z
2019-05-31T07:45:12.493Z
GGG
<p>I am using Terraform to create aws resources. I practiced with a single region and with my aws cli credentials being used. worked great!</p>

<p>however when I tried to override the region in the Terraform .tf config file it hangs indefinitely.</p>

<p>So how does one either set my aws credentials for the CLI to allow any region, OR how does one set Terraform config files (.tf) to allow multi region infrastructure?</p>

<terraform><amazon-s3><aws-cli><aws-iam>
How to override default aws region credentials for Terraform?
Alan-Cugler
# How to override default aws region credentials for Terraform?

(Asked by: username_0 on 2019-05-29)

I am using Terraform to create aws resources. I practiced with a single region and with my aws cli credentials being used. worked great!

however when I tried to override the region in the Terraform .tf config file it hangs indefinitely.

So how does one either set my aws credentials for the CLI to allow any region, OR how does one set Terraform config files (.tf) to allow multi region infrastructure?

**Tags:** terraform, amazon-s3, aws-cli, aws-iam


---

## 1 answers

### Answer by username_1 on 2019-05-30. Score: 1

I believe you would be using multiple modules to create various resources(EC2,ELB, Etc) in AWS using Terraform. You can create a custom module having output value of each variable you want to configure per your requirement like aws-region, etc.
Then source(import) this custom module into your resource module and use its values using $.
custom_module
output "aws_region" {
  value = "us-xyz-1"
}
output "aws_anyproperty" {
  value = "abc"
}

Add above custom_module as source in your resource module

module "custom_module" {
  source="../../../modules/custom_module"
}

provider "aws" {
  version="~> y.x"
  profile="${module.custom_module.aws_anyproperty}"
  region="${module.custom_module.aws_region}"
}


---

