YJWANG

Terraform 에서 libvirt 플러그인 설치하기 본문

91.IaC

Terraform 에서 libvirt 플러그인 설치하기

왕영주 2020. 9. 30. 21:19

아래 github 경로에서 더욱 더 상세헌 내용을 볼 수 있다.

이번 포스팅에선 plugin 다운로드 설치 및 확인 까지만 포스팅하고 실제 적용 사례는 따로 포스팅할 예정이다.

https://github.com/dmacvicar/terraform-provider-libvirt

ENV

# OS
  CentOS 7.X
# terraform v12.29
  wget https://releases.hashicorp.com/terraform/0.12.29/terraform_0.12.29_linux_amd64.zip                                                  
# terraform-libvirt-plugin v0.6.2
  wget https://github.com/dmacvicar/terraform-provider-libvirt/releases/download/v0.6.2/terraform-provider-libvirt-0.6.2+git.1585292411.8cbe9ad0.Fedora_28.x86_64.tar.gz

설치 및 적용

terraform-provider-libvirt 파일을 아래 경로에 복사 후 확인

[root@yjwangHost terraform]# ~/.terraform.d/plugins/terraform-provider-libvirt -version
/root/.terraform.d/plugins/terraform-provider-libvirt 0.6.2+git.1585292411.8cbe9ad0
Compiled against library: libvirt 4.1.0
Using library: libvirt 4.5.0
Running hypervisor: QEMU 2.12.0
Running against daemon: 4.5.0

terraform 파일을 /usr/bin/ 에 복사

[root@yjwangHost terraform]# ls -l /usr/bin/terraform
-rwxr-xr-x. 1 root root 69818041  7월 23 00:46 /usr/bin/terraform

terraform을 사용할 Directory 생성 후 테스트 파일 생성

[root@yjwangHost terraform]# mkdir /root/terraform
[root@yjwangHost terraform]# cat libvirt.tf
provider "libvirt" {
    uri = "qemu:///system"
}

이후 같은 Directory에서 테스트 진행

[root@yjwangHost terraform]# terraform init

Initializing the backend...

Initializing provider plugins...

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

TO-DO

나중에 terraform 13 및 CentOS8.X 에서도 테스트해봐야 함 아래 링크를 참조

https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/docs/migration-13.md
반응형