Svetlin Zamfirov d827f4f757 Adding custom shielded images support (GCP)
Adds `enable_secure_boot`, `enable_vtpm` and `enable_integrity_monitoring`
config options to enable building of custom Shielded GCP Compute images.

Feedback on this is more than welcome as this is my first attempt in
contributing to anything Packer related.

Packer is great for us to build custom images on top of GCP but we would
like to enhance that to support Shielded VM images. This will allow us
to have more secure and trusted images which our team(s) will be using.
2020-04-16 16:22:41 -07:00

36 lines
641 B
Go

package googlecompute
import (
"strings"
compute "google.golang.org/api/compute/v1"
)
type Image struct {
GuestOsFeatures []*compute.GuestOsFeature
Labels map[string]string
Licenses []string
Name string
ProjectId string
SelfLink string
SizeGb int64
}
func (i *Image) IsWindows() bool {
for _, license := range i.Licenses {
if strings.Contains(license, "windows") {
return true
}
}
return false
}
func (i *Image) IsSecureBootCompatible() bool {
for _, osFeature := range i.GuestOsFeatures {
if osFeature.Type == "SECURE_BOOT" {
return true
}
}
return false
}