1
0

More than 3 years have passed since last update.

複数リージョンのサービス使用時はMultiple Providerを使用する

Last updated at Posted at 2020-03-11

複数のリージョンに分散するサービスを作成したい場合、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)
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0