Compute VM module refactor (#3805)

* add ad for compute-vm refactor

* Exclue nic_type from validated fields, add split of main.tf and template.tf

* boot disk

* fix examples and fixtures

* attached disks

* fix further examples and module-level tests

* remove extra file

* fix mig examples

* finish refactoring variables

* align fast and other modules

* refactor(compute-vm): align examples and ADR with the newly implemented interface

This commit addresses the remaining references of the `instance_type` and `confidential_compute` parameters in the testing environment and updates the ADR.

* feat(compute-vm): add network_performance_config to instance and templates

This change implements the usage of the `network_performance_tier` variable we added earlier into the actual Terraform resources.

---------

Co-authored-by: Wiktor Niesiobędzki <wiktorn@google.com>
This commit is contained in:
Ludovico Magnocavallo
2026-03-26 12:31:40 +01:00
committed by GitHub
parent 2c39df6453
commit a4eb4d24fd
64 changed files with 1971 additions and 1119 deletions

View File

@@ -45,7 +45,7 @@ module "nginx-template" {
addresses = null
}]
boot_disk = {
initialize_params = {
source = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}
@@ -88,7 +88,7 @@ module "nginx-template" {
addresses = null
}]
boot_disk = {
initialize_params = {
source = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}
@@ -139,7 +139,7 @@ module "nginx-template" {
addresses = null
}]
boot_disk = {
initialize_params = {
source = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}
@@ -191,7 +191,7 @@ module "nginx-template" {
addresses = null
}]
boot_disk = {
initialize_params = {
source = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}
@@ -242,7 +242,7 @@ module "nginx-template" {
addresses = null
}]
boot_disk = {
initialize_params = {
source = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}
@@ -287,27 +287,28 @@ module "cos-nginx" {
}
module "nginx-template" {
source = "./fabric/modules/compute-vm"
project_id = var.project_id
name = "nginx-template"
zone = "${var.region}-b"
tags = ["http-server", "ssh"]
instance_type = "e2-small"
source = "./fabric/modules/compute-vm"
project_id = var.project_id
name = "nginx-template"
zone = "${var.region}-b"
tags = ["http-server", "ssh"]
machine_type = "e2-small"
network_interfaces = [{
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}]
boot_disk = {
initialize_params = {
source = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}
attached_disks = [{
source_type = "attach"
name = "data-1"
size = 10
source = google_compute_disk.test-disk.name
}]
attached_disks = {
data-1 = {
source = {
attach = google_compute_disk.test-disk.name
}
}
}
create_template = {}
metadata = {
user-data = module.cos-nginx.cloud_config
@@ -338,27 +339,28 @@ module "cos-nginx" {
}
module "nginx-template" {
source = "./fabric/modules/compute-vm"
project_id = var.project_id
name = "nginx-template"
zone = "${var.region}-b"
tags = ["http-server", "ssh"]
instance_type = "e2-small"
source = "./fabric/modules/compute-vm"
project_id = var.project_id
name = "nginx-template"
zone = "${var.region}-b"
tags = ["http-server", "ssh"]
machine_type = "e2-small"
network_interfaces = [{
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}]
boot_disk = {
initialize_params = {
source = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}
attached_disks = [{
source_type = "attach"
name = "data-1"
size = 10
source = google_compute_disk.test-disk.name
}]
attached_disks = {
data-1 = {
source = {
attach = google_compute_disk.test-disk.name
}
}
}
create_template = {}
metadata = {
user-data = module.cos-nginx.cloud_config
@@ -413,7 +415,7 @@ module "nginx-template" {
addresses = null
}]
boot_disk = {
initialize_params = {
source = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}