Open raptorrico opened 1 year ago
Hi @raptorrico, not sure this helps with your use-case, but I override the value of my variable update
(which is true
by default) using packer build -var update=false ...
to skip updates for faster testing, see below:
provisioner "windows-update" {
search_criteria = "IsInstalled=0"
filters = var.update ? ["exclude:$true"] : [
"exclude:$_.Title -like '*Preview*'",
"exclude:$_.Title -like '*Silverlight*'",
"exclude:$_.InstallationBehavior.CanRequestUserInput",
"include:$true"
]
}
´´´
I need to conditionally define the parameter values for SearchCriteria and Filters. Would I need to run the windows-update.ps1 script rather than using the provisioner?
For example, set variables for both and then call the script
$varSearchCriteria = 'IsInstalled=0' $varFilters = @('include:$true')
windows-update.ps1 -SearchCriteria $varCriteria -Filters $varFilters
Is it possible to achieve the above using the provisioner?