Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for enabling nested virtualization on intermediate instance #123

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions builder/googlecompute/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ type Config struct {
// }
// ```
DiskEncryptionKey *CustomerEncryptionKey `mapstructure:"disk_encryption_key" required:"false"`
// Create a instance with enabling nested virtualization.
EnableNestedVirtualization bool `mapstructure:"enable_nested_virtualization" required:"false"`
// Create a Shielded VM image with Secure Boot enabled. It helps ensure that
// the system only runs authentic software by verifying the digital signature
// of all boot components, and halting the boot process if signature verification
Expand Down
2 changes: 2 additions & 0 deletions builder/googlecompute/config.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions builder/googlecompute/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ type InstanceConfig struct {
DiskSizeGb int64
DiskType string
DiskEncryptionKey *CustomerEncryptionKey
EnableNestedVirtualization bool
EnableSecureBoot bool
EnableVtpm bool
EnableIntegrityMonitoring bool
Expand Down
3 changes: 3 additions & 0 deletions builder/googlecompute/driver_gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {

// Create the instance information
instance := compute.Instance{
AdvancedMachineFeatures: &compute.AdvancedMachineFeatures{
EnableNestedVirtualization: c.EnableNestedVirtualization,
},
Description: c.Description,
Disks: []*compute.AttachedDisk{
{
Expand Down
1 change: 1 addition & 0 deletions builder/googlecompute/step_create_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func (s *StepCreateInstance) Run(ctx context.Context, state multistep.StateBag)
DiskSizeGb: c.DiskSizeGb,
DiskType: c.DiskType,
DiskEncryptionKey: c.DiskEncryptionKey,
EnableNestedVirtualization: c.EnableNestedVirtualization,
EnableSecureBoot: c.EnableSecureBoot,
EnableVtpm: c.EnableVtpm,
EnableIntegrityMonitoring: c.EnableIntegrityMonitoring,
Expand Down
2 changes: 2 additions & 0 deletions docs-partials/builder/googlecompute/Config-not-required.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
}
```

- `enable_nested_virtualization` (bool) - Create a instance with enabling nested virtualization.

- `enable_secure_boot` (bool) - Create a Shielded VM image with Secure Boot enabled. It helps ensure that
the system only runs authentic software by verifying the digital signature
of all boot components, and halting the boot process if signature verification
Expand Down