umig access_config values only apply to a single instance
rebelpacket opened this issue · 1 comments
rebelpacket commented
TL;DR
I'm trying to build out a umig of 3 compute instances, with external IP addresses to accept load balanced traffic.
When I specify null values for the access_config parameters, only the first compute instance gets an external IP address.
Expected behavior
Both instances get external ip addresses
Observed behavior
Only the first instance gets an external IP address
Terraform Configuration
locals {
rma_named_ports = [{
name = var.rma_service_port_name
port = var.rma_service_port
}]
access_config = [{
nat_ip = null
network_tier = null
}]
}
module "rma-web-central1-template" {
source = "terraform-google-modules/vm/google//modules/instance_template"
source_image = var.rma_source_image
machine_type = "n1-standard-4"
region = var.region
project_id = var.project_id
access_config = local.access_config
subnetwork = "production-us-central1-vpc"
tags = ["ssh", "webserver", "rma"]
disk_size_gb = "20"
metadata = {
env = "production"
owner = "engineering"
role = "webserver"
}
service_account = var.rma_service_account
}
module "rma-webservers-central1" {
source = "terraform-google-modules/vm/google//modules/umig"
version = "7.4.0"
project_id = var.project_id
subnetwork = "production-us-central1-vpc"
num_instances = var.rma_num_webservers
hostname = "rma-web-central1"
instance_template = module.rma-web-central1-template.self_link
named_ports = local.rma_named_ports
region = var.region
access_config = [local.access_config]
}
Terraform Version
Terraform v1.0.10
on darwin_amd64
Additional information
Below is the change when I updated the access_config local variable. It appears that the count.index on line 61 in main.tf is likely the cause of this issue.
Terraform will perform the following actions:
# module.rma-webservers-central1.google_compute_instance_from_template.compute_instance[0] will be updated in-place
~ resource "google_compute_instance_from_template" "compute_instance" {
id = "projects/xxxxx/zones/us-central1-a/instances/rma-web-central1-001"
name = "rma-web-central1-001"
tags = [
"rma",
"ssh",
"webserver",
]
# (21 unchanged attributes hidden)
~ network_interface {
~ access_config = [
+ {
+ nat_ip = null
+ network_tier = null
+ public_ptr_domain_name = null
},
]
name = "nic0"
# (6 unchanged attributes hidden)
}
# (4 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
github-actions commented
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days