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

Promote enable_confidential_compute for disks to v1. #9789

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion mmv1/products/compute/Disk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ properties:
description: |
Whether this disk is using confidential compute mode.
Note: Only supported on hyperdisk skus, disk_encryption_key is required when setting to true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to verify that this is correct, since it's not mentioned in the API docs? If not, could be good to fix in a follow-on PR.

min_version: beta
required: false
default_from_api: true
- !ruby/object:Api::Type::Boolean
Expand Down
6 changes: 6 additions & 0 deletions mmv1/products/compute/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ properties:
the disk, hyperdisk allows for an update of throughput every
4 hours. To update your hyperdisk more frequently,
you'll need to manually delete and recreate it.
- !ruby/object:Api::Type::Boolean
name: 'enableConfidentialCompute'
description: |
Whether this disk is using confidential compute mode.
Note: Only supported on hyperdisk skus, disk_encryption_key
is required when setting to true.
- !ruby/object:Api::Type::NestedObject
name: 'sourceImageEncryptionKey'
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,6 @@ func TestAccComputeDisk_encryptionKMS(t *testing.T) {
})
}

<% unless version == 'ga' -%>
func TestAccComputeDisk_pdHyperDiskEnableConfidentialCompute(t *testing.T) {
t.Skip()
harshulsoni marked this conversation as resolved.
Show resolved Hide resolved
t.Parallel()
Expand Down Expand Up @@ -596,7 +595,6 @@ func TestAccComputeDisk_pdHyperDiskEnableConfidentialCompute(t *testing.T) {
},
})
}
<% end -%>

func TestAccComputeDisk_deleteDetach(t *testing.T) {
t.Parallel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ var (
"boot_disk.0.initialize_params.0.resource_manager_tags",
"boot_disk.0.initialize_params.0.provisioned_iops",
"boot_disk.0.initialize_params.0.provisioned_throughput",
<% unless version == 'ga' -%>
"boot_disk.0.initialize_params.0.enable_confidential_compute",
<% end -%>
}

schedulingKeys = []string{
Expand Down Expand Up @@ -267,15 +265,13 @@ func ResourceComputeInstance() *schema.Resource {
Description: `Indicates how much throughput to provision for the disk. This sets the number of throughput mb per second that the disk can handle. Values must be between 1 and 7,124.`,
},

<% unless version == 'ga' -%>
"enable_confidential_compute": {
Type: schema.TypeBool,
Optional: true,
AtLeastOneOf: initializeParamsKeys,
ForceNew: true,
Description: `A flag to enable confidential compute mode on boot disk`,
},
<% end -%>
},
},
},
Expand Down Expand Up @@ -2832,11 +2828,9 @@ func expandBootDisk(d *schema.ResourceData, config *transport_tpg.Config, projec
disk.InitializeParams.ProvisionedThroughput = int64(v.(int))
}

<% unless version == 'ga' -%>
if v, ok := d.GetOk("boot_disk.0.initialize_params.0.enable_confidential_compute"); ok {
disk.InitializeParams.EnableConfidentialCompute = v.(bool)
}
<% end -%>

if v, ok := d.GetOk("boot_disk.0.initialize_params.0.type"); ok {
diskTypeName := v.(string)
Expand Down Expand Up @@ -2905,9 +2899,7 @@ func flattenBootDisk(d *schema.ResourceData, disk *compute.AttachedDisk, config
"resource_manager_tags": d.Get("boot_disk.0.initialize_params.0.resource_manager_tags"),
"provisioned_iops": diskDetails.ProvisionedIops,
"provisioned_throughput": diskDetails.ProvisionedThroughput,
<% unless version == 'ga' -%>
"enable_confidential_compute": diskDetails.EnableConfidentialCompute,
<% end -%>
}}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1822,8 +1822,6 @@ func TestAccComputeInstanceConfidentialInstanceConfigMain(t *testing.T) {
})
}


<% unless version == 'ga' -%>
func TestAccComputeInstance_confidentialHyperDiskBootDisk(t *testing.T) {
t.Parallel()
kms := acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-hyperdisk-key1")
Expand Down Expand Up @@ -1862,7 +1860,6 @@ func TestAccComputeInstance_confidentialHyperDiskBootDisk(t *testing.T) {
},
})
}
<% end -%>

func TestAccComputeInstance_hyperdiskBootDisk_provisioned_iops_throughput(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -7060,7 +7057,6 @@ resource "google_compute_instance" "foobar" {
`, instance, enableConfidentialCompute)
}

<% unless version == 'ga' -%>
func testAccComputeInstanceConfidentialHyperDiskBootDisk(context map[string]interface{}) string {
return acctest.Nprintf(`
data "google_compute_image" "my_image" {
Expand All @@ -7078,7 +7074,7 @@ resource "google_kms_crypto_key_iam_member" "crypto_key" {

resource "google_compute_instance" "foobar" {
name = "%{instance_name}"
machine_type = "n2-standard-2"
machine_type = "h3-standard-88"
zone = "%{zone}"

boot_disk {
Expand All @@ -7100,7 +7096,6 @@ resource "google_compute_instance" "foobar" {
}
`, context)
}
<% end -%>

func testAccComputeInstanceHyperDiskBootDiskProvisionedIopsThroughput(context map[string]interface{}) string {
return acctest.Nprintf(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ is desired, you will need to modify your state file manually using
recreate the disk, hyperdisk allows for an update of throughput every 4 hours.
To update your hyperdisk more frequently, you'll need to manually delete and recreate it.

* `enable_confidential_compute` - (Optional) Whether this disk is using confidential compute mode.
harshulsoni marked this conversation as resolved.
Show resolved Hide resolved
Note: Only supported on hyperdisk skus, disk_encryption_key is required when setting to true.

<a name="nested_scratch_disk"></a>The `scratch_disk` block supports:

* `interface` - (Required) The disk interface to use for attaching this disk; either SCSI or NVME.
Expand Down