본문 바로가기

퍼블릭 클라우드

[Terraform] 테라폼 인터넷 게이트웨이 생성

반응형

인터넷 게이트웨이 생성

(선행 작업)

- VPC 생성

 

igw.tf 파일 생성

$ vim igw.tf
###인터넷 게이트웨이 생성
resource "aws_internet_gateway" "sangchul_vpc11-igw" {
    vpc_id                  = aws_vpc.sangchul_vpc11.id
    tags = {
        Name                = "sangchul_vpc11-igw"
        Env                 = "stg"
        CreateUser          = "terraform@email.com"
        Owner               = "iac"
        Role                = "internet_gateway"
        Service             = "network"
    }
}

terraform apply 명령 실행

$ terraform apply
aws_vpc.sangchul_vpc11: Refreshing state... [id=vpc]
aws_subnet.sangchul_vpc11-sb14: Refreshing state... [id=subnet]
aws_subnet.sangchul_vpc11-sb13: Refreshing state... [id=subnet]
aws_subnet.sangchul_vpc11-sb3: Refreshing state... [id=subnet]
aws_subnet.sangchul_vpc11-sb4: Refreshing state... [id=subnet]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

...

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_internet_gateway.sangchul_vpc11-igw: Creating...
aws_internet_gateway.sangchul_vpc11-igw: Creation complete after 5s [id=igw]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

 

728x90
반응형