Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- resource "azurerm_network_interface" "default" {
- name = "${format("%sNIC%s%03d", var.environment, var.short_identifier_prefix, count.index)}"
- location = "${var.region}"
- resource_group_name = "${var.resource_group_name}"
- network_security_group_id = "${var.nsg_id}"
- enable_ip_forwarding = true
- ip_configuration {
- name = "${format("%sIP%s%03d", var.environment, var.short_identifier_prefix, count.index)}"
- subnet_id = "${azurerm_subnet.default.id}"
- private_ip_address_allocation = "static"
- private_ip_address = "${cidrhost(azurerm_subnet.default.address_prefix, count.index + 10)}"
- load_balancer_backend_address_pools_ids = ["${var.load_balancer_backend_pool}"]
- load_balancer_inbound_nat_rules_ids = ["${ element(var.load_balancer_nat_rules, count.index) }"]
- }
- count = "${var.is_nat_rules ? var.count : 0}"
- }
- resource "azurerm_network_interface" "nonat" {
- name = "${format("%sNIC%s%03d", var.environment, var.short_identifier_prefix, count.index)}"
- location = "${var.region}"
- resource_group_name = "${var.resource_group_name}"
- network_security_group_id = "${var.nsg_id}"
- enable_ip_forwarding = true
- ip_configuration {
- name = "${format("%sIP%s%03d", var.environment, var.short_identifier_prefix, count.index)}"
- subnet_id = "${azurerm_subnet.default.id}"
- private_ip_address_allocation = "static"
- private_ip_address = "${cidrhost(azurerm_subnet.default.address_prefix, count.index + 10)}"
- load_balancer_backend_address_pools_ids = ["${var.load_balancer_backend_pool}"]
- }
- count = "${var.is_nat_rules ? 0 : var.count}"
- }
- network_interface_ids = ["${var.is_nat_rules ? element(azurerm_network_interface.default.*.id, count.index) : element(azurerm_network_interface.nonat.*.id, count.index)}"]
- * module.VME.azurerm_virtual_machine.default[0]: element: element() may not be used with an empty list in:
- ${var.is_nat_rules ? element(azurerm_network_interface.default.*.id, count.index) : element(azurerm_network_interface.nonat.*.id, count.index)}
Add Comment
Please, Sign In to add comment