Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- resource "azurerm_virtual_machine" "elasticsearch" {
- name = "elnode${count.index + 1}"
- location = "${var.location}"
- resource_group_name = "${azurerm_resource_group.test.name}"
- vm_size = "Standard_A0"
- network_interface_ids = ["${element(azurerm_network_interface.inet.*.id, count.index + 1)}"]
- count = 2
- #--PROVISIONING NODES WITH CHEF----------
- provisioner "chef" {
- run_list = ["elk::sometest"]
- node_name = "elnode${count.index + 1}"
- server_url = "${var.chef["server_url"]}"
- validation_client_name = "${var.chef["validation_client_name"]}"
- validation_key = "${file(".chef/some-validator.pem")}"
- connection {
- user = "${var.chef["server_url"]}"
- key_file = "~/.ssh/id_rsa"
- agent = false
- }
- }
- #--END PROVISIONING------------------------------------
- storage_image_reference {
- publisher = "${var.vmparams["publisher"]}"
- offer = "${var.vmparams["offer"]}"
- sku = "${var.vmparams["sku"]}"
- version = "latest"
- }
- storage_os_disk {
- name = "elnode${count.index + 1}"
- vhd_uri = "${azurerm_storage_account.testsa.primary_blob_endpoint}${azurerm_storage_container.test.name}/elnode${count.index + 1}.vhd"
- create_option = "FromImage"
- caching = "ReadWrite"
- }
- os_profile {
- computer_name = "elnode${count.index + 1}"
- admin_username = "${var.vmparams["login"]}"
- admin_password = "${var.vmparams["passw"]}"
- }
- os_profile_linux_config {
- disable_password_authentication = true
- ssh_keys {
- path = "/home/${var.vmparams["login"]}/.ssh/authorized_keys"
- key_data = "${file("~/.ssh/id_rsa.pub")}"
- }
- }
- }
- #-----------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement