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

optionals for additional_networks #12

Merged
merged 2 commits into from
Apr 16, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_access_config"></a> [access\_config](#input\_access\_config) | Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. | <pre>list(object({<br> nat_ip = optional(any, null)<br> network_tier = optional(string, "PREMIUM")<br> }))</pre> | `[]` | no |
| <a name="input_additional_networks"></a> [additional\_networks](#input\_additional\_networks) | Additional network interface details for GCE, if any. | <pre>list(object({<br> network = string<br> subnetwork = string<br> subnetwork_project = string<br> network_ip = any<br> access_config = list(object({<br> nat_ip = string<br> network_tier = string<br> }))<br> }))</pre> | `[]` | no |
| <a name="input_additional_networks"></a> [additional\_networks](#input\_additional\_networks) | Additional network interface details for GCE, if any. | <pre>list(object({<br> network = optional(string, null)<br> subnetwork = optional(string, null)<br> subnetwork_project = optional(string, null)<br> network_ip = optional(any, null)<br> access_config = optional(list(object({<br> nat_ip = string<br> network_tier = string<br> })), [])<br> }))</pre> | `[]` | no |
| <a name="input_auto_delete"></a> [auto\_delete](#input\_auto\_delete) | Whether or not the boot disk should be auto-deleted | `bool` | `true` | no |
| <a name="input_can_ip_forward"></a> [can\_ip\_forward](#input\_can\_ip\_forward) | Enable IP forwarding, for NAT instances for example | `bool` | `false` | no |
| <a name="input_deletion_protection"></a> [deletion\_protection](#input\_deletion\_protection) | Enable deletion protection on this instance. Note: you must disable deletion protection before removing the resource, or the instance cannot be deleted and the Terraform run will not complete successfully. | `bool` | `false` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ resource "google_compute_instance" "compute_instance" {
network = network_interface.value.network
subnetwork = network_interface.value.subnetwork
subnetwork_project = network_interface.value.subnetwork_project
network_ip = length(network_interface.value.network_ip) > 0 ? try(network_interface.value.network_ip[count.index], network_interface.value.network_ip) : null
network_ip = network_interface.value.network_ip
dynamic "access_config" {
for_each = network_interface.value.access_config
content {
Expand Down
12 changes: 6 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ variable "additional_networks" {
description = "Additional network interface details for GCE, if any."
default = []
type = list(object({
network = string
subnetwork = string
subnetwork_project = string
network_ip = any
access_config = list(object({
network = optional(string, null)
subnetwork = optional(string, null)
subnetwork_project = optional(string, null)
network_ip = optional(any, null)
access_config = optional(list(object({
nat_ip = string
network_tier = string
}))
})), [])
}))
}
Loading