본문 바로가기

퍼블릭 클라우드

[Terraform] 테라폼 VPC 생성

반응형

VPC 생성

vpc.tf 파일 생성

$ vim vpc.tf
###VPC 생성
resource "aws_vpc" "sangchul_vpc11" {
    cidr_block              = "10.11.0.0/16"
    enable_dns_support      = true
    enable_dns_hostnames    = true
    instance_tenancy        = "default"
    tags = {
        Name                = "sangchul_vpc11"
        Env                 = "stg"
        CreateUser          = "terraform@email.com"
        Owner               = "iac"
        Role                = "vpc"
        Service             = "network"
    }
}

terraform apply 명령 실행

$ terraform apply

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_vpc.sangchul_vpc11: Creating...
aws_vpc.sangchul_vpc11: Still creating... [10s elapsed]
aws_vpc.sangchul_vpc11: Creation complete after 12s [id=vpc]

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

** VPN 생성 시 기본 Route Tables, Network ACLs, Security Groups도 같이 생성됩니다.

 

728x90
반응형