Terraform으로 NCP 구축하기(3) - terraform apply

2025. 5. 8. 17:58·Infra

0. 최종 형태

최종적으로 아래와 같은 화면처럼 NCP에서 생성한 인스턴스를 확인가능하다.

- 부팅중, 설정중, 운영중 순으로 바뀌며 최종적으로  운영중이 떴다면, 성공적으로 실행된 것이다.

1. 테라폼 구성 적용

아래의 명령어로 정의한 서버 및 VPC, Subnet을 생성 가능하다.

cd terraform-ncp
# 최신 Provider 확보를 위해
terraform init -upgrade   # 프로바이더 충돌 방지 :contentReference[oaicite:3]{index=3}
terraform plan
terraform apply -auto-approve

 

1-1. 나는 따로 planfile을 만들고, planfile을 통해 실행했다.

planfile 생성

 ~/Documents/study/zapply/Zaply-server/terraform | main ?1  terraform plan -out=planfile                                                        1 err | 22:09:00 
module.server.data.ncloud_server_image.ubuntu: Reading...
module.server.data.ncloud_server_image.ubuntu: Read complete after 0s [id=SW.VSVR.OS.LNX64.UBNTU.SVR2004.B050]
module.server.data.ncloud_server_product.spec: Reading...
module.server.data.ncloud_server_product.spec: Read complete after 0s [id=SVR.VSVR.HICPU.C002.M004.NET.SSD.B050.G002]

planfile 적용

 ~/Documents/study/zapply/Zaply-server/terraform | main ?1  terraform apply planfile                        
module.network.ncloud_vpc.this: Creating...
module.server.ncloud_login_key.bastion_key: Creating...
.
.
.
.
.
.

module.server.ncloud_server.bastion: Still creating... [5m20s elapsed]
module.server.ncloud_server.bastion: Still creating... [5m30s elapsed]
module.server.ncloud_server.bastion: Still creating... [5m40s elapsed]
module.server.ncloud_server.bastion: Creation complete after 5m46s [id=104813546]
module.server.data.ncloud_root_password.root_pw: Reading...
module.server.ncloud_public_ip.bastion_ip: Creating...
module.server.ncloud_public_ip.bastion_ip: Creation complete after 3s [id=104813595]

 

2. 생성 정보 조회 및 삭제

# 생성된 서버 정보 조회
terraform state show module.server.ncloud_public_ip.bastion_ip
#PEM 파일 권한 수정
chmod 400 tf-ncp-bastion-key.pem
# 서버에 SSH 접속
ssh -i tf-ncp-bastion-key.pem root@<PUBLIC_IP>

# 비밀번호 변경
passwd root
# 생성한 리소스 모두 삭제
terraform destroy -auto-approve

 

저작자표시 비영리 동일조건 (새창열림)

'Infra' 카테고리의 다른 글

모니터링 환경을 구축 Promtail, Loki, Prometheus, Grafana, Logback  (0) 2025.05.26
Terraform으로 NCP 구축하기(4) - Object Storage 구성하기  (0) 2025.05.08
Terraform으로 NCP 구축하기(2) - VPC, Subnet, Server 띄우기  (0) 2025.05.08
NCP SSL 인증서 발급 및 DNS 인증  (0) 2025.05.01
도커 네트워크 - 도커네트워크 생성 및 추가  (0) 2025.05.01
'Infra' 카테고리의 다른 글
  • 모니터링 환경을 구축 Promtail, Loki, Prometheus, Grafana, Logback
  • Terraform으로 NCP 구축하기(4) - Object Storage 구성하기
  • Terraform으로 NCP 구축하기(2) - VPC, Subnet, Server 띄우기
  • NCP SSL 인증서 발급 및 DNS 인증
SungHoJung
SungHoJung
  • SungHoJung
    HOLOUD
    SungHoJung
  • 전체
    오늘
    어제
    • 분류 전체보기 (40)
      • AlgoMate (13)
      • TroubleShooting (0)
      • 여러가지 모음집 (4)
      • Infra (17)
  • 링크

    • github
  • 인기 글

  • 태그

    로컬 서버와 통신
    IAM
    recaptcha 우회
    ci-cd
    크롤링한 데이터
    Celery
    host.docker.internal
    ECS
    redis
    메세지 브로커
    AWS
    bypass recaptcha
    컨테이너 간 통신
    celery+rabbitmq
    Kubernetes
    docker-compose
    k8s
    celery+redis
    스왑 메모리 설정
    EC2
  • hELLO· Designed By정상우.v4.10.3
SungHoJung
Terraform으로 NCP 구축하기(3) - terraform apply
상단으로

티스토리툴바