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

fix!: Remove unnecessary breaking changes when upgrading to v11.0.0+ #417

Closed
Closed
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion modules/instance_template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ See the [simple](../../examples/instance_template/simple) for a usage example.
| subnetwork\_project | The ID of the project in which the subnetwork belongs. If it is not provided, the provider project is used. | `string` | `""` | no |
| tags | Network tags, provided as a list | `list(string)` | `[]` | no |
| threads\_per\_core | The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. | `number` | `null` | no |
| total\_egress\_bandwidth\_tier | Egress bandwidth tier setting for supported VM families | `string` | `"DEFAULT"` | no |
| total\_egress\_bandwidth\_tier | Egress bandwidth tier setting for supported VM families. Valid values are 'DEFAULT' or 'TIER_1' | `string` | `null` | no |
thatcoleyouknow marked this conversation as resolved.
Show resolved Hide resolved

## Outputs

Expand Down
9 changes: 7 additions & 2 deletions modules/instance_template/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ locals {
# initialize the block only if it is enabled.
shielded_vm_configs = var.enable_shielded_vm ? [true] : []

create_network_performance_config = var.total_egress_bandwidth_tier != null

gpu_enabled = var.gpu != null
alias_ip_range_enabled = var.alias_ip_range != null
on_host_maintenance = (
Expand Down Expand Up @@ -206,8 +208,11 @@ resource "google_compute_instance_template" "tpl" {
enable_confidential_compute = var.enable_confidential_vm
}

network_performance_config {
total_egress_bandwidth_tier = var.total_egress_bandwidth_tier
dynamic "network_performance_config" {
for_each = local.create_network_performance_config ? [var.total_egress_bandwidth_tier] : []
content {
total_egress_bandwidth_tier = network_performance_config.value
}
}

dynamic "guest_accelerator" {
Expand Down
6 changes: 3 additions & 3 deletions modules/instance_template/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ variable "additional_networks" {
}

variable "total_egress_bandwidth_tier" {
description = "Egress bandwidth tier setting for supported VM families"
description = "Egress bandwidth tier setting for supported VM families. Valid values are 'DEFAULT' or 'TIER_1'."
type = string
default = "DEFAULT"
default = null
validation {
condition = contains(["DEFAULT", "TIER_1"], var.total_egress_bandwidth_tier)
condition = var.total_egress_bandwidth_tier != null ? contains(["DEFAULT", "TIER_1"], var.total_egress_bandwidth_tier) : true
error_message = "Allowed values for bandwidth_tier are 'DEFAULT' or 'TIER_1'."
}
}
Expand Down
Loading