본문 바로가기
프로그래밍 언어/terraform

[terraform] template v2.2.0 does not have a package available for your current platform, darwin_arm64 오류 처리

by hs_seo 2024. 2. 18.

M1 맥북에서 테라폼 코드를 작성할 때 'template_cloudinit_confg'를 이용하면 오류가 발생합니다.

 

- Using previously-installed terraform-provider-openstack/openstack v1.53.0
╷
│ Error: Incompatible provider version
│ 
│ Provider registry.terraform.io/hashicorp/template v2.2.0 does not have a package available for your current platform, darwin_arm64.
│ 
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.
╵

 

template_cloudinit_confg가 deprecate 되고, cloudinit_config 로 변경되고 난 후 M1 맥북이 출시 되어 정식으로는 지원되지 않기 때문입니다.

 

해결 방법은 두가지 입니다.

 

먼저 소스코드를 변경하는 방법입니다. 다음과 같이 cloudinit_config와 templatefile 함수를 함께 사용하여 동일한 결과를 이용할 수 있습니다.

 

# deprecate 되어 사용 안됨 
data "template_cloudinit_config" "config" {
  gzip          = true
}


# templatefile 함수와 함께 cloudinit_confg 를 사용 
data "cloudinit_config" "config" {
  gzip          = true
 
  content      = templatefile("cloud-init.yaml", {
    name = "test"
  })
}

 

두 번째는 M1 맥북에서 사용할 수 있도록 빌드 하는 방법입니다. kreuzwerker 사에서 빌드 할 수 있는 파일을 제공하기 때문에 brew 를 이용하여 다음과 같이 설치하여 사용할 수 있습니다.

 

brew install kreuzwerker/taps/m1-terraform-provider-helper
m1-terraform-provider-helper activate
m1-terraform-provider-helper install hashicorp/template -v v2.2.0

 

https://discuss.hashicorp.com/t/template-v2-2-0-does-not-have-a-package-available-mac-m1/35099/6

 

Template v2.2.0 does not have a package available - Mac M1

I did not encounter this error. Maybe worth opening an issue at m1-terraform-provider-helper.

discuss.hashicorp.com

 

반응형