From 759d2451a4f108fbf5f11236a283eaffff8b0447 Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Thu, 6 Aug 2020 15:09:42 -0400 Subject: [PATCH] post-processor/googlecompute-export: Remove IAP configuration from HCL schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build results before change ``` [go-1.14.2] [2] wilken@automaton in ~/Development/packer-templates/googlecompute/googlecompute-startup-scripts/ on master ⇶ packer build -var project=$GOOGLE_PROJECT_ID googlecompute-ubuntu-startup-script-export.pkr.hcl Error: Failed preparing post-processor-block "googlecompute-export" "" on googlecompute-ubuntu-startup-script-export.pkr.hcl line 28: (source code not available) 1 error occurred: * unknown configuration key: '"iap"' ==> Builds finished but no artifacts were created. ``` Build results after change ``` ⇶ packer build -var project=$GOOGLE_PROJECT_ID googlecompute-ubuntu-startup-script-export.pkr.hcl googlecompute.example: output will be in this color. ==> googlecompute.example: Checking image does not exist... ==> googlecompute.example: Creating temporary SSH key for instance... ``` --- post-processor/googlecompute-export/post-processor.go | 7 +++---- .../googlecompute-export/post-processor.hcl2spec.go | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/post-processor/googlecompute-export/post-processor.go b/post-processor/googlecompute-export/post-processor.go index 7341e6cfb..70434543c 100644 --- a/post-processor/googlecompute-export/post-processor.go +++ b/post-processor/googlecompute-export/post-processor.go @@ -23,7 +23,7 @@ type Config struct { common.PackerConfig `mapstructure:",squash"` AccountFile string `mapstructure:"account_file"` - IAP bool `mapstructure:"iap"` + IAP bool `mapstructure-to-hcl2:",skip"` DiskSizeGb int64 `mapstructure:"disk_size"` DiskType string `mapstructure:"disk_type"` @@ -34,9 +34,8 @@ type Config struct { VaultGCPOauthEngine string `mapstructure:"vault_gcp_oauth_engine"` Zone string `mapstructure:"zone"` ServiceAccountEmail string `mapstructure:"service_account_email"` - - account *jwt.Config - ctx interpolate.Context + account *jwt.Config + ctx interpolate.Context } type PostProcessor struct { diff --git a/post-processor/googlecompute-export/post-processor.hcl2spec.go b/post-processor/googlecompute-export/post-processor.hcl2spec.go index f01b94214..dc752016a 100644 --- a/post-processor/googlecompute-export/post-processor.hcl2spec.go +++ b/post-processor/googlecompute-export/post-processor.hcl2spec.go @@ -17,7 +17,6 @@ type FlatConfig struct { 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"` AccountFile *string `mapstructure:"account_file" cty:"account_file" hcl:"account_file"` - IAP *bool `mapstructure:"iap" cty:"iap" hcl:"iap"` DiskSizeGb *int64 `mapstructure:"disk_size" cty:"disk_size" hcl:"disk_size"` DiskType *string `mapstructure:"disk_type" cty:"disk_type" hcl:"disk_type"` MachineType *string `mapstructure:"machine_type" cty:"machine_type" hcl:"machine_type"` @@ -49,7 +48,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "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}, "account_file": &hcldec.AttrSpec{Name: "account_file", Type: cty.String, Required: false}, - "iap": &hcldec.AttrSpec{Name: "iap", Type: cty.Bool, Required: false}, "disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false}, "disk_type": &hcldec.AttrSpec{Name: "disk_type", Type: cty.String, Required: false}, "machine_type": &hcldec.AttrSpec{Name: "machine_type", Type: cty.String, Required: false},