Hi,
Something that was working fine prior 0.15. I have module that I am reusing in multiple regions/providers in aws with different VARs. How can I do this in >=0.15?
The sample module configuration working in Terraform prior 0.15 is:
provider "aws" {
region = "eu-west-1"
profile = "bastion"
assume_role {
role_arn = "arn:aws:iam::1234567890:role/role"
session_name = "terraform"
}
}
provider "aws" {
region = "us-east-1"
alias = "use1"
profile = "bastion"
assume_role {
role_arn = "arn:aws:iam::1234567890:role/role"
session_name = "terraform"
}
}
provider "aws" {
region = "eu-west-2"
profile = "bastion"
alias = "euw2"
assume_role {
role_arn = "arn:aws:iam::1234567890:role/role"
session_name = "terraform"
}
}
module "eu-db-backup-destination" {
source = "../modules/offsite-backup-aurora-destination"
destination-kms-key = "arn:aws:kms:eu-west-1:1234567890:key/xxx"
source-kms-key = "arn:aws:kms:eu-west-1:0987654321:key/yyy"
retention-days = "90"
database-id = "eu-cluster"
region = var.region
tags = var.tags
}
module "us-db-backup-destination" {
source = "../modules/offsite-backup-aurora-destination"
providers = {
aws = aws.use1
}
destination-kms-key = "arn:aws:kms:us-east-1:1234567890:key/xxx"
source-kms-key = "arn:aws:kms:us-east-1:0987654321:key/yyy"
retention-days = "90"
database-id = "us-cluster"
region = var.region
tags = var.tags
}
module "eu2-db-backup-destination" {
source = "../modules/offsite-backup-aurora-destination"
providers = {
aws = aws.euw2
}
destination-kms-key = "arn:aws:kms:eu-west-2:1234567890:key/xxx"
source-kms-key = "arn:aws:kms:eu-west-2:0987654321:key/yyy"
retention-days = "90"
database-id = "eu2-cluster"
region = "eu-west-2"
tags = var.tags
}
For 0.15 it wants me to add all remaining providers to the each module and then it wants to create it each region. How can I do this to make it working like it was in <0.15?