Packer
Azure
@hashicorp
Packer can create Azure virtual machine images through variety of ways depending on the strategy that you want to use for building the images.
- Official
- HCP Ready
Updated 2 years ago
- GitHub(opens in new tab)
DTL Artifact
Type: azure-dtlartifact
The Azure DevTest Labs provisioner can be used to apply an artifact to a VM - See Add an artifact to a VM
Azure DevTest Labs provisioner specific options
Required:
dtl_artifacts
([]DtlArtifact) - Dtl Artifactslab_name
(string) - Name of the existing lab where the virtual machine exist.lab_resource_group_name
(string) - Name of the resource group where the lab exist.vm_name
(string) - Name of the virtual machine within the DevTest lab.
Optional:
polling_duration_timeout
(duration string | ex: "1h5m2s") - The default PollingDuration for azure is 15mins, this property will override that value. See Azure DefaultPollingDuration If your Packer build is failing on the ARM deployment step with the errorOriginal Error: context deadline exceeded
, then you probably need to increase this timeout from its default of "15m" (valid time units includes
for seconds,m
for minutes, andh
for hours.)azure_tags
(map[string]*string) - Azure Tags
DtlArtifact
artifact_name
(string) - Artifact Nameartifact_id
(string) - Artifact Idparameters
([]ArtifactParameter) - Parameters
ArtifactParmater
name
(string) - Namevalue
(string) - Valuetype
(string) - Type
Basic Example
source "null" "example" {
communicator = "none"
}
build {
sources = ["source.null.example"]
provisioner "azure-dtlartifact" {
lab_name = "packer-test"
lab_resource_group_name = "packer-test"
vm_name = "packer-test-vm"
dtl_artifacts {
artifact_name = "linux-apt-package"
parameters {
name = "packages"
value = "vim"
}
parameters {
name = "update"
value = "true"
}
parameters {
name = "options"
value = "--fix-broken"
}
}
}
}