Guest User

Untitled

a guest
Feb 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. resource "azurerm_network_interface" "default" {
  2. name = "${format("%sNIC%s%03d", var.environment, var.short_identifier_prefix, count.index)}"
  3. location = "${var.region}"
  4. resource_group_name = "${var.resource_group_name}"
  5. network_security_group_id = "${var.nsg_id}"
  6. enable_ip_forwarding = true
  7.  
  8. ip_configuration {
  9. name = "${format("%sIP%s%03d", var.environment, var.short_identifier_prefix, count.index)}"
  10. subnet_id = "${azurerm_subnet.default.id}"
  11. private_ip_address_allocation = "static"
  12. private_ip_address = "${cidrhost(azurerm_subnet.default.address_prefix, count.index + 10)}"
  13. load_balancer_backend_address_pools_ids = ["${var.load_balancer_backend_pool}"]
  14. load_balancer_inbound_nat_rules_ids = ["${ element(var.load_balancer_nat_rules, count.index) }"]
  15. }
  16.  
  17. count = "${var.is_nat_rules ? var.count : 0}"
  18. }
  19.  
  20. resource "azurerm_network_interface" "nonat" {
  21. name = "${format("%sNIC%s%03d", var.environment, var.short_identifier_prefix, count.index)}"
  22. location = "${var.region}"
  23. resource_group_name = "${var.resource_group_name}"
  24. network_security_group_id = "${var.nsg_id}"
  25. enable_ip_forwarding = true
  26.  
  27. ip_configuration {
  28. name = "${format("%sIP%s%03d", var.environment, var.short_identifier_prefix, count.index)}"
  29. subnet_id = "${azurerm_subnet.default.id}"
  30. private_ip_address_allocation = "static"
  31. private_ip_address = "${cidrhost(azurerm_subnet.default.address_prefix, count.index + 10)}"
  32. load_balancer_backend_address_pools_ids = ["${var.load_balancer_backend_pool}"]
  33. }
  34.  
  35. count = "${var.is_nat_rules ? 0 : var.count}"
  36. }
  37.  
  38. network_interface_ids = ["${var.is_nat_rules ? element(azurerm_network_interface.default.*.id, count.index) : element(azurerm_network_interface.nonat.*.id, count.index)}"]
  39.  
  40. * module.VME.azurerm_virtual_machine.default[0]: element: element() may not be used with an empty list in:
  41.  
  42. ${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