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 3 years ago
- GitHub(opens in new tab)
Key Vault Secret
The Key Vault Secret data source provides information about an Azure Key Vault's secret, including its value and metadata.
Note: Data sources is a feature exclusively available to HCL2 templates.
Basic examples of usage:
data "azure-keyvaultsecret" "basic-example" {
vault_name = "packer-test-vault"
secret_name = "test-secret"
}
# usage example of the data source output
locals {
value = data.azure-keyvaultsecret.basic-example.value
payload = data.azure-keyvaultsecret.basic-example.payload
}
Reading key-value pairs from JSON back into a native Packer map can be accomplished with the jsondecode() function.
Configuration Reference
Required
vault_name
(string) - The name of the Azure Key Vault.secret_name
(string) - The name of the secret to fetch from the Azure Key Vault.
Optional
version
(string) - The version of the secret to fetch. If not provided, the latest version will be used.
Output Data
response
(string) - The raw string response of the secret version.value
(string) - The value extracted using the 'key', if provided.
Authentication
To authenticate with Azure Key Vault, this data-source supports everything the plugin does. To get more information on this, refer to the plugin's description page, under the authentication section.