Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. resource "azurerm_virtual_machine" "elasticsearch" {
  2. name = "elnode${count.index + 1}"
  3. location = "${var.location}"
  4. resource_group_name = "${azurerm_resource_group.test.name}"
  5. vm_size = "Standard_A0"
  6. network_interface_ids = ["${element(azurerm_network_interface.inet.*.id, count.index + 1)}"]
  7. count = 2
  8.  
  9. #--PROVISIONING NODES WITH CHEF----------
  10.  
  11. provisioner "chef" {
  12. run_list = ["elk::sometest"]
  13. node_name = "elnode${count.index + 1}"
  14. server_url = "${var.chef["server_url"]}"
  15. validation_client_name = "${var.chef["validation_client_name"]}"
  16. validation_key = "${file(".chef/some-validator.pem")}"
  17.  
  18. connection {
  19. user = "${var.chef["server_url"]}"
  20. key_file = "~/.ssh/id_rsa"
  21. agent = false
  22. }
  23.  
  24. }
  25.  
  26. #--END PROVISIONING------------------------------------
  27. storage_image_reference {
  28. publisher = "${var.vmparams["publisher"]}"
  29. offer = "${var.vmparams["offer"]}"
  30. sku = "${var.vmparams["sku"]}"
  31. version = "latest"
  32. }
  33.  
  34. storage_os_disk {
  35. name = "elnode${count.index + 1}"
  36. vhd_uri = "${azurerm_storage_account.testsa.primary_blob_endpoint}${azurerm_storage_container.test.name}/elnode${count.index + 1}.vhd"
  37. create_option = "FromImage"
  38. caching = "ReadWrite"
  39. }
  40.  
  41. os_profile {
  42. computer_name = "elnode${count.index + 1}"
  43. admin_username = "${var.vmparams["login"]}"
  44. admin_password = "${var.vmparams["passw"]}"
  45.  
  46. }
  47.  
  48. os_profile_linux_config {
  49. disable_password_authentication = true
  50.  
  51. ssh_keys {
  52. path = "/home/${var.vmparams["login"]}/.ssh/authorized_keys"
  53. key_data = "${file("~/.ssh/id_rsa.pub")}"
  54. }
  55. }
  56. }
  57. #-----------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement