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

Add Confidential Computing examples to google_compute_instance and google_compute_instance_template resources #11518

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
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,57 @@ resource "google_compute_instance" "default" {
}
```

## Example usage - Confidential Computing

Example with [Confidential Mode](https://cloud.google.com/confidential-computing/confidential-vm/docs/confidential-vm-overview) activated.

```tf
resource "google_service_account" "default" {
account_id = "my-custom-sa"
display_name = "Custom SA for VM Instance"
}

resource "google_compute_instance" "confidential_instance" {
name = "my-confidential-instance"
zone = "us-central1-a"
machine_type = "n2d-standard-2"
min_cpu_platform = "AMD Milan"

confidential_instance_config {
enable_confidential_compute = true
confidential_instance_type = "SEV"
}

boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-2004-lts"
labels = {
my_label = "value"
}
}
}

// Local SSD disk
scratch_disk {
interface = "NVME"
}

network_interface {
network = "default"

access_config {
// Ephemeral public IP
}
}

service_account {
# Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
email = google_service_account.default.email
scopes = ["cloud-platform"]
}
}
```

## Argument Reference

The following arguments are supported:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,47 @@ With this setup Terraform generates a unique name for your Instance
Template and can then update the Instance Group manager without conflict before
destroying the previous Instance Template.

## Example usage - Confidential Computing

Example with [Confidential Mode](https://cloud.google.com/confidential-computing/confidential-vm/docs/confidential-vm-overview) activated.

```tf
resource "google_service_account" "default" {
account_id = "my-custom-sa"
display_name = "Custom SA for VM Instance"
}

resource "google_compute_instance_template" "confidential_instance_template" {
name = "my-confidential-instance-template"
region = "us-central1"
machine_type = "n2d-standard-2"
min_cpu_platform = "AMD Milan"

confidential_instance_config {
enable_confidential_compute = true
confidential_instance_type = "SEV"
}

disk {
source_image = "ubuntu-os-cloud/ubuntu-2004-lts"
}

network_interface {
network = "default"

access_config {
// Ephemeral public IP
}
}

service_account {
# Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
email = google_service_account.default.email
scopes = ["cloud-platform"]
}
}
```

## Deploying the Latest Image

A common way to use instance templates and managed instance groups is to deploy the
Expand Down
Loading