resource "azurerm_virtual_machine_scale_set" "${MyResource}" {
         name = "my-${MyResource}-name"
         location = "West US"
         resource_group_name = "\${azurerm_resource_group.test.name}"
         upgrade_policy_mode = "Manual"
      
         sku {
             name = "Standard_A0"
             tier = "Standard"
             capacity = 2
         }
      
         os_profile {
             computer_name_prefix = "testvm"
             admin_username = "myadmin"
             admin_password = "Passwword1234"
         }
      
         os_profile_linux_config {
             disable_password_authentication = true
             ssh_keys {
                 path = "/home/myadmin/.ssh/authorized_keys"
                 key_data = "\${file("~/.ssh/demo_key.pub")}"
             }
         }
      
         network_profile {
             name = "TestNetworkProfile"
             primary = true
             ip_configuration {
                 name = "TestIPConfiguration"
                 subnet_id = "\${azurerm_subnet.test.id}"
             }
         }
      
         storage_profile_os_disk {
             name = "osDiskProfile"
             caching       = "ReadWrite"
             create_option = "FromImage"
             vhd_containers = ["\${azurerm_storage_account.test.primary_blob_endpoint}\${azurerm_storage_container.test.name}"]
         }
      
         storage_profile_image_reference {
             publisher = "Canonical"
             offer     = "UbuntuServer"
             sku       = "14.04.2-LTS"
             version   = "latest"
         }
      }
      Terraform language logo

      azurerm_virtual_machine_scale_set

      Terraform snippets

      First we create a resource called my-name with the name West US.

      Next we create a resource group called test.name, and assign the my-name resource to the group.

      Next, we specify the upgrade policy mode as Manual.

      Next, we create two virtual machines, one with the name Standard_A0 and the other with the name osDiskProfile.

      Next, we create a network profile called TestNetworkProfile and set the primary flag to true.

      Next, we create a storage profile called osDiskProfile and set the caching option to ReadWrite.

      Next, we create an image reference for the osDiskProfile profile and set the publisher to Canonical and the offer to UbuntuServer.

      Finally, we create a virtual machine with the name Standard_A0 and the profile osDiskProfile.

      Shortcut: tf_azurerm_virtual_machine_scale_set

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.