diff --git a/templates/xcode.pkr.hcl b/templates/xcode.pkr.hcl index fb0a7a1..866381d 100644 --- a/templates/xcode.pkr.hcl +++ b/templates/xcode.pkr.hcl @@ -167,12 +167,16 @@ build { } } - provisioner "shell" { - inline = [ - "source ~/.zprofile", - "sudo xcodes select '${var.xcode_version[1]}'", - "xcodebuild -downloadAllPlatforms", - ] + dynamic "provisioner" { + for_each = length(var.xcode_version) > 1 ? [1] : [] + labels = ["shell"] + content { + inline = [ + "source ~/.zprofile", + "sudo xcodes select '${var.xcode_version[1]}'", + "xcodebuild -downloadAllPlatforms", + ] + } } provisioner "shell" {