Skip to content

Commit

Permalink
Revert "Adding in support for confidential_compute on boot disk (Goog…
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson authored Oct 16, 2023
1 parent 92f92bf commit 2def020
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ var (
"boot_disk.0.initialize_params.0.image",
"boot_disk.0.initialize_params.0.labels",
"boot_disk.0.initialize_params.0.resource_manager_tags",
<% unless version == 'ga' -%>
"boot_disk.0.initialize_params.0.enable_confidential_compute",
<% end -%>
}

schedulingKeys = []string{
Expand Down Expand Up @@ -244,15 +241,6 @@ func ResourceComputeInstance() *schema.Resource {
ForceNew: true,
Description: `A map of resource manager tags. Resource manager tag keys and values have the same definition as resource manager tags. Keys must be in the format tagKeys/{tag_key_id}, and values are in the format tagValues/456. The field is ignored (both PUT & PATCH) when empty.`,
},
<% unless version == 'ga' -%>
"enable_confidential_compute": {
Type: schema.TypeBool,
Optional: true,
AtLeastOneOf: initializeParamsKeys,
ForceNew: true,
Description: `A flag to enble confidential compute mode on boot disk`,
},
<% end -%>
},
},
},
Expand Down Expand Up @@ -2741,12 +2729,6 @@ func expandBootDisk(d *schema.ResourceData, config *transport_tpg.Config, projec
disk.InitializeParams.DiskSizeGb = 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)
diskType, err := readDiskType(config, d, diskTypeName)
Expand Down Expand Up @@ -2812,9 +2794,6 @@ func flattenBootDisk(d *schema.ResourceData, disk *compute.AttachedDisk, config
"size": diskDetails.SizeGb,
"labels": diskDetails.Labels,
"resource_manager_tags": d.Get("boot_disk.0.initialize_params.0.resource_manager_tags"),
<% unless version == 'ga' -%>
"enable_confidential_compute": diskDetails.EnableConfidentialCompute,
<% end -%>
}}
}

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

<% unless version = 'ga' -%>
func TestAccComputeInstance_confidentialHyperDiskBootDisk(t *testing.T) {
t.Parallel()

context_1 := map[string]interface{}{
"instance_name": fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)),
"confidential_compute": true,
"kms_key" : acctest.BootstrapKMSKey(t)
"zone": "us-central1-a"
}

context_2 := map[string]interface{}{
"instance_name": context_1["instance_name"],
"confidential_compute": false,
"kms_key" : context_1["kms_key"],
"zone": context_1["zone]
}


acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccComputeInstanceConfidentialHyperDiskBootDisk(context_1),
},
computeInstanceImportStep(context_1["zone"], context_1["instance_name"], []string{"allow_stopping_for_update"}),
{
Config: testAccComputeInstanceConfidentialHyperDiskBootDisk(context_2),
},
computeInstanceImportStep(context_2["zone"], context_2["instance_name"], []string{"allow_stopping_for_update"}),
},
})
}
<% end -%>

func TestAccComputeInstance_enableDisplay(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -6887,39 +6850,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" {
family = "ubuntu-2204-lts"
project = "ubuntu-os-cloud"
}

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

boot_disk {

initialize_params {
image = data.google_compute_image.my_image.self_link
enable_confidential_compute = %{confidential_compute}
type = "hyperdisk-balanced"
}

kms_key_self_link = "%{kms_key}"
}

network_interface {
network = "default"
}
}
`, context)
}
<% end -%>

func testAccComputeInstance_enableDisplay(instance string) string {
return fmt.Sprintf(`
data "google_compute_image" "my_image" {
Expand Down

0 comments on commit 2def020

Please sign in to comment.