테라폼 init/apply/destroy

terraform init

일단, 디렉토리와 메인파일을 만들어 봅시다.

mkdir infra-by-terraform && cd infra-by-terraform
touch main.tf

terraform init

# main.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.27"
    }
  }

  required_version = ">= 0.14.9"
}

provider "aws" {
  profile = "default"
  region  = "ap-northeast-2"
}

resource "aws_instance" "app_server" {
  ami           = "ami-014009fa4a1467d53"
  instance_type = "t2.micro"

  tags = {
    Name = "TerraformInstance"
  }
}

terraform init


terraform apply

terraform apply


terraform destroy

terraform destroy



테라폼이란 무엇인가라는 아주 좋은 영상이 있다.
HashiCorp의 공동 창업자이자 CTO가 직접 설명해주는 영상이라니.... 아주 훌륭하다

좋은 웹페이지 즐겨찾기