Untitled

Untitled

terraform-study/tgw-multi.tf at main · pinetree2/terraform-study

이번주차 목표! 멀티리전으로 tgw 해보기

//한국, 도쿄, 버지니아 리전
locals {
    regions = ["ap-northeast-2", "ap-northeast-1", "us-east-1"]
}
resource "aws_vpc" "vpc" {
    count = 3
    cidr_block = "10.0.${count.index}.0/16"
    tags = {
        Name = "vpc-${count.index}"
    }
    provider = aws.regions[count.index]
}

<aside> 💡 이번 주차의 핵심

<aside> ❓ 궁금한점 peering 과 tgw 를 어떻게 연결?

</aside>

multi region 응용 코드 어떻게 작성해야 하나

  1. 찾다가 발견한 multi-region-deployment-in-aws-with-terraform

    이라는 글…은 근데 state 파일 공유에 대해 얘기하는 것 같음

    S3에 많이 활용되는 backend-state

    Multi-region Deployment on AWS with Terraform

  2. 모듈과 alias 를 활용함

    Creating AWS resources with Terraform across multiple regions

  3. alias 를 활용함

    https://github.com/chrismarget/multi-region-terraform-example

    폴더별로 리소스 나누고

    모듈과 output 활용함

  4. tgw 를 multi region 에서 하다가 오류난 사람의 글 (큰 도움은 안됨)

    보니까 data 랑 filter 라는걸 씀

    자세히는 안봤음 당장필요하지않아

    https://discuss.hashicorp.com/t/multi-region-issue-in-transit-gateway/26116

    Multi Region Issue In Transit Gateway