Hi all, we need to create several db’s in the same aws account but different region.
I understand that the secret lies in the providers.tf file where we got
provider "aws" {
access_key = var.AWS_ACCESS_KEY_ID
secret_key = var.AWS_SECRET_ACCESS_KEY
region = var.aws_region
}
and that makes all db’s to be created within 1 region, how can i have different region per db?
i tried to work with aliases,
provider "aws" {
alias = "fr"
access_key = "${var.AWS_ACCESS_KEY_ID}"
secret_key = "${var.AWS_SECRET_ACCESS_KEY}"
region = "eu-central-1"
Then i tried to call it within the module - but i cannot call the provider from within the module
module "db1" {
source = "terraform-aws-modules/rds/aws"
version = "3.3.0"
providers {
aws = "aws.fr"
}
identifier = "db1"
This is the detailed error
│ Error: Unsupported block type
│
│ on main.tf line 221, in module "db1":
│ 221: providers {
│
│ Blocks of type "providers" are not expected here.
Thank you!