provider "aws" {
alias = "sin"
region = "ap-southeast-1"
}
provider "aws" {
alias = "mum"
region = "ap-south-1"
}
resource "aws_sns_topic" "alarms_sin" {
provider = aws.sin
name = "${local.name_prefix}-alarms-${GET_CURRENT_REGION}"
}
resource "aws_sns_topic" "alarms_mum" {
provider = aws.mum
name = "${local.name_prefix}-alarms-${GET_CURRENT_REGION}"
}
通常,您可以使用data "aws_region" "current" {}
之类的数据块,但在这种情况下不起作用。
答案 0 :(得分:2)
我能够通过在数据块中添加提供程序来解决它-
provider "aws" {
alias = "sin"
region = "ap-southeast-1"
}
provider "aws" {
alias = "mum"
region = "ap-south-1"
}
// Change
data "aws_region" "sin" {
provider = "aws.sin"
}
data "aws_region" "mum" {
provider = "aws.mum"
}
resource "aws_sns_topic" "alarms_sin" {
provider = aws.sin
name = "${local.name_prefix}-alarms-${data.aws_region.sin.name}"
}
resource "aws_sns_topic" "alarms_mum" {
provider = aws.mum
name = "${local.name_prefix}-alarms-${data.aws_region.mum.name}"
}