[TF] Terraform으로 VPC 구성 기본 -1

제이브로·2024년 7월 3일

Terraform

목록 보기
5/10
post-thumbnail

1. provider.tf

VPCprovider.tf

  • provider : aws
  • region : ap-northeast-2
provider "aws" {
  region  = "ap-northeast-2"
}

2. resource.tf

VPCresource.tf

  • 필수적으로 필요한 설정 : cidr_block
  • resource : aws_vpc
  • reource name : main
  • cidr_block : 10.0.0.0/16
  • tag name : terraform-101
resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"

  tags = {
    Name = "terraform-101"
  }
}

3. terraform 적용

  1. terraform plan을 통해 제대로 작성했는지 확인
  2. terraform apply 에러가 없다면, 실제 서버에 apply하여 resource 생성

4. References

  1. 처음 시작하는 Infrastructure as Code: AWS & 테라폼
profile
기록하지 않으면 기록되지 않는다.

0개의 댓글