Fixes related to boot_disk in compute-vm module

This commit is contained in:
Miren Esnaola 2023-03-16 14:30:05 +01:00
parent 79a6e9b191
commit 21fa6d1f13
19 changed files with 89 additions and 52 deletions

View File

@ -310,11 +310,13 @@ module "simple-vm-example" {
zone = "europe-west1-b"
name = "test"
boot_disk = {
initialize_params = {
image = "projects/debian-cloud/global/images/family/cos-97-lts"
type = "pd-balanced"
size = 10
}
}
}
```
Where this results in objects with too many attributes, we usually split attributes between required and optional by adding a second level, as in this example where VM `attached_disks[].options` contains less used attributes and can be set to null if not needed.

View File

@ -30,10 +30,12 @@ module "mgmt_server" {
}]
service_account_create = true
boot_disk = {
initialize_params = {
image = var.mgmt_server_config.image
type = var.mgmt_server_config.disk_type
size = var.mgmt_server_config.disk_size
}
}
metadata = {
startup-script = <<EOT
#!/bin/bash

View File

@ -81,10 +81,12 @@ module "server" {
}
service_account_create = true
boot_disk = {
initialize_params = {
image = var.image
type = var.disk_type
size = var.disk_size
}
}
group = {
named_ports = {
https = 443

View File

@ -234,10 +234,12 @@ module "test-vm" {
zone = "${var.region}-b"
name = "nginx-test"
boot_disk = {
initialize_params = {
image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
}
}
metadata = {
user-data = module.cos-nginx.cloud_config
google-logging-enabled = true

View File

@ -46,10 +46,12 @@ module "test-vm" {
service_account = module.service-account-sql.email
service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
boot_disk = {
initialize_params = {
image = "projects/debian-cloud/global/images/family/debian-10"
type = "pd-ssd"
size = 10
}
}
encryption = var.service_encryption_keys != null ? {
encrypt_boot = true
disk_encryption_key_raw = null

View File

@ -134,10 +134,11 @@ module "vm_example" {
}
]
boot_disk = {
initialize_params = {
image = "projects/debian-cloud/global/images/family/debian-10"
type = "pd-ssd"
size = 10
encrypt_disk = true
}
}
tags = ["ssh"]
encryption = {

View File

@ -73,10 +73,12 @@ module "nodes" {
}]
boot_disk = {
initialize_params = {
image = var.node_image
type = "pd-ssd"
size = var.boot_disk_size
}
}
attached_disks = [{
name = "${each.value}-datadisk"

View File

@ -32,9 +32,11 @@ module "mgmt_server" {
}]
service_account_create = true
boot_disk = {
initialize_params = {
image = var.mgmt_server_config.image
type = var.mgmt_server_config.disk_type
size = var.mgmt_server_config.disk_size
}
}
tags = ["ssh"]
}

View File

@ -30,9 +30,11 @@ module "mgmt_server" {
}]
service_account_create = true
boot_disk = {
initialize_params = {
image = var.mgmt_server_config.image
type = var.mgmt_server_config.disk_type
size = var.mgmt_server_config.disk_size
}
}
}

View File

@ -289,8 +289,10 @@ module "proxy-vm" {
subnetwork = module.vpc.subnet_self_links[format("%s/%s", var.region, var.subnetwork)]
}]
boot_disk = {
initialize_params = {
image = "projects/cos-cloud/global/images/family/cos-stable"
}
}
create_template = true
metadata = {
user-data = !var.tls ? module.cos-nginx.0.cloud_config : module.cos-nginx-tls.0.cloud_config

View File

@ -302,8 +302,10 @@ module "vm-onprem" {
instance_type = "f1-micro"
name = "onprem"
boot_disk = {
initialize_params = {
image = "ubuntu-os-cloud/ubuntu-1804-lts"
}
}
metadata = {
user-data = module.config-onprem.cloud_config
}

View File

@ -23,10 +23,12 @@ module "gw" {
instance_type = "f1-micro"
boot_disk = {
initialize_params = {
image = "projects/ubuntu-os-cloud/global/images/family/ubuntu-2004-lts",
type = "pd-ssd",
size = 10
}
}
network_interfaces = [
{

View File

@ -161,8 +161,10 @@ module "test-vm" {
name = "${var.name}-test"
instance_type = "e2-micro"
boot_disk = {
initialize_params = {
image = "projects/ubuntu-os-cloud/global/images/family/ubuntu-2104"
}
}
network_interfaces = [{
network = module.vpc-onprem.self_link
subnetwork = module.vpc-onprem.subnet_self_links["${var.region}/${var.name}-onprem"]

View File

@ -58,10 +58,12 @@ module "vm" {
google-logging-enabled = true
}
boot_disk = {
initialize_params = {
image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
}
}
tags = ["ssh"]
}
# tftest skip

View File

@ -41,10 +41,12 @@ module "vm" {
google-logging-enabled = true
}
boot_disk = {
initialize_params = {
image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
}
}
tags = ["dns", "ssh"]
}
# tftest modules=1 resources=1

View File

@ -25,10 +25,12 @@ module "vm-nginx-tls" {
google-logging-enabled = true
}
boot_disk = {
initialize_params = {
image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
}
}
tags = ["http-server", "https-server", "ssh"]
}
# tftest modules=1 resources=1

View File

@ -41,10 +41,12 @@ module "vm-nginx-tls" {
google-logging-enabled = true
}
boot_disk = {
initialize_params = {
image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
}
}
tags = ["http-server", "ssh"]
}
# tftest modules=1 resources=1

View File

@ -54,10 +54,12 @@ module "vm" {
google-logging-enabled = true
}
boot_disk = {
initialize_params = {
image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
}
}
tags = ["nva", "ssh"]
}
# tftest modules=1 resources=1

View File

@ -132,10 +132,12 @@ module "instance-group" {
addresses = null
}]
boot_disk = {
initialize_params = {
image = "projects/cos-cloud/global/images/family/cos-stable"
type = "pd-ssd"
size = 10
}
}
tags = ["http-server", "ssh"]
metadata = {
user-data = module.cos-nginx.cloud_config