terraform으로 aws VPC 만들기 실습

도은호·2025년 9월 22일

terraform

목록 보기
9/32

파일 만들기

aws Documentation 참고하기

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc

main.tf

resource "aws_vpc" "user07-vpc" {
  cidr_block = var.cidr_block

  tags = {
    Name = "user07-vpc"
  }
}

vars.tf

variable "region" {
  type    = string
  default = "ap-northeast-2"
}

variable "cidr_block" {
  type    = string
  default = "10.7.0.0/16"
}

provider.tf

# terraform {
#   required_providers {
#     aws = {
#       source = "hashicorp/aws"
#       version = "6.13.0"
#     }
#   }
# }

provider "aws" {
  region = var.region
}

apply 하기

aws에서 확인하기

profile
`•.¸¸.•´´¯`••._.• 🎀 𝒸𝓇𝒶𝓏𝓎 𝓅𝓈𝓎𝒸𝒽💞𝓅𝒶𝓉𝒽 🎀 •._.••`¯´´•.¸¸.•`

0개의 댓글