Terraform 실습 (2)

김승윤·2021년 10월 18일
0

Virtual studio code 실행

06_TEST라는 폴더를 만들고 vs code에서 폴더를 열어줍니다.

01_main.tf라는 파일을 만들고 자료처럼 내용을 적어줍니다.

내용을 저장하고 터미널창에

terraform init
terraform plan
terraform apply

차례대로 입력하며 내용을 확인합니다.

apply 명령어를 치면
"Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve."이 나오는데

오로지 yes를 쳤을 때만 계속 실행됩니다.


02_instance.tf 파일을 만들고 다음과 같이 내용을 넣어줍니다.

terraform init
terraform plan
terraform apply

명령어 실행 후 aws 콘솔에서 instance 생성을 확인합니다.

삭제하는 명령어는

terraform destroy

apply 명령어와 마찬가지로 'yes'를 입력해줘야 합니다.

0개의 댓글