複数のリージョンに分散するサービスを作成したい場合、Multiple Providerを使用すると便利です。
- main.tf
provider "aws" {
region = "ap-northeast-1"
profile = "terraform01"
}
// multiple provider
provider "aws" {
region = "us-east-1"
alias = "virginia"
profile = "terraform02"
}
- 例えば、globalaccelerator_accelerato.tf
resource "aws_globalaccelerator_accelerator" "select" {
provider = aws.virginia
(snip)
- 例えば、aws_wafv2_web_acl.tf
resource "aws_wafv2_web_acl" "select" {
name = "aws_wafv2_web_acl"
scope = "CLOUDFRONT"
provider = aws.virginia
default_action {
block {}
}
(snip)
- 例えば、data.aws_lambda_function
data "aws_lambda_function" "latest_lambda" {
function_name = "latest"
provider = aws.virginia
(snip)
}