From f28c06a861e597590d30f023478e567495607f67 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Fri, 21 Aug 2020 13:32:21 +0200 Subject: [PATCH] HCL: re-add the option to set a command for inspec (#9800) --- provisioner/inspec/provisioner.go | 4 ++-- provisioner/inspec/provisioner.hcl2spec.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/provisioner/inspec/provisioner.go b/provisioner/inspec/provisioner.go index d3449ef6e..438321689 100644 --- a/provisioner/inspec/provisioner.go +++ b/provisioner/inspec/provisioner.go @@ -41,8 +41,8 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` ctx interpolate.Context - // The command to run inspec - Command string `mapstructure-to-hcl2:",skip"` + // The command to invoke InSpec. Defaults to `inspec`. + Command string `mapstructure-to-hcl2:"command"` SubCommand string `mapstructure-to-hcl2:",skip"` // Extra options to pass to the inspec command diff --git a/provisioner/inspec/provisioner.hcl2spec.go b/provisioner/inspec/provisioner.hcl2spec.go index 04abb92e7..179f9d37b 100644 --- a/provisioner/inspec/provisioner.hcl2spec.go +++ b/provisioner/inspec/provisioner.hcl2spec.go @@ -16,6 +16,7 @@ type FlatConfig struct { PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` + Command *string `mapstructure-to-hcl2:"command" cty:"command" hcl:"command"` ExtraArguments []string `mapstructure:"extra_arguments" cty:"extra_arguments" hcl:"extra_arguments"` InspecEnvVars []string `mapstructure:"inspec_env_vars" cty:"inspec_env_vars" hcl:"inspec_env_vars"` Profile *string `mapstructure:"profile" cty:"profile" hcl:"profile"` @@ -48,6 +49,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "packer_on_error": &hcldec.AttrSpec{Name: "packer_on_error", Type: cty.String, Required: false}, "packer_user_variables": &hcldec.AttrSpec{Name: "packer_user_variables", Type: cty.Map(cty.String), Required: false}, "packer_sensitive_variables": &hcldec.AttrSpec{Name: "packer_sensitive_variables", Type: cty.List(cty.String), Required: false}, + "command": &hcldec.AttrSpec{Name: "command", Type: cty.String, Required: false}, "extra_arguments": &hcldec.AttrSpec{Name: "extra_arguments", Type: cty.List(cty.String), Required: false}, "inspec_env_vars": &hcldec.AttrSpec{Name: "inspec_env_vars", Type: cty.List(cty.String), Required: false}, "profile": &hcldec.AttrSpec{Name: "profile", Type: cty.String, Required: false},