github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/website/source/docs/providers/azurerm/r/virtual_machine_scale_sets.html.markdown (about)

     1  ---
     2  layout: "azurerm"
     3  page_title: "Azure Resource Manager: azurerm_virtual_machine_scale_sets"
     4  sidebar_current: "docs-azurerm-resource-virtualmachine-scale-sets"
     5  description: |-
     6    Create a Virtual Machine scale set.
     7  ---
     8  
     9  # azurerm\_virtual\_machine\_scale\_sets
    10  
    11  Create a virtual machine scale set.
    12  
    13  ## Example Usage
    14  
    15  ```
    16  resource "azurerm_resource_group" "test" {
    17      name = "acctestrg"
    18      location = "West US"
    19  }
    20  
    21  resource "azurerm_virtual_network" "test" {
    22      name = "acctvn"
    23      address_space = ["10.0.0.0/16"]
    24      location = "West US"
    25      resource_group_name = "${azurerm_resource_group.test.name}"
    26  }
    27  
    28  resource "azurerm_subnet" "test" {
    29      name = "acctsub"
    30      resource_group_name = "${azurerm_resource_group.test.name}"
    31      virtual_network_name = "${azurerm_virtual_network.test.name}"
    32      address_prefix = "10.0.2.0/24"
    33  }
    34  
    35  resource "azurerm_network_interface" "test" {
    36      name = "acctni"
    37      location = "West US"
    38      resource_group_name = "${azurerm_resource_group.test.name}"
    39  
    40      ip_configuration {
    41      	name = "testconfiguration1"
    42      	subnet_id = "${azurerm_subnet.test.id}"
    43      	private_ip_address_allocation = "dynamic"
    44      }
    45  }
    46  
    47  resource "azurerm_storage_account" "test" {
    48      name = "accsa"
    49      resource_group_name = "${azurerm_resource_group.test.name}"
    50      location = "westus"
    51      account_type = "Standard_LRS"
    52  
    53      tags {
    54          environment = "staging"
    55      }
    56  }
    57  
    58  resource "azurerm_storage_container" "test" {
    59      name = "vhds"
    60      resource_group_name = "${azurerm_resource_group.test.name}"
    61      storage_account_name = "${azurerm_storage_account.test.name}"
    62      container_access_type = "private"
    63  }
    64  
    65  resource "azurerm_virtual_machine_scale_set" "test" {
    66    name = "mytestscaleset-1"
    67    location = "West US"
    68    resource_group_name = "${azurerm_resource_group.test.name}"
    69    upgrade_policy_mode = "Manual"
    70  
    71    sku {
    72      name = "Standard_A0"
    73      tier = "Standard"
    74      capacity = 2
    75    }
    76  
    77    virtual_machine_os_profile {
    78      computer_name_prefix = "testvm"
    79      admin_username = "myadmin"
    80      admin_password = "Passwword1234"
    81    }
    82  
    83    virtual_machine_os_profile_linux_config {
    84      disable_password_authentication = true
    85      ssh_keys {
    86        path = "/home/myadmin/.ssh/authorized_keys"
    87        key_data = "${file("~/.ssh/demo_key.pub")}"
    88      }
    89    }
    90  
    91    virtual_machine_network_profile {
    92        name = "TestNetworkProfile"
    93        primary = true
    94        ip_configuration {
    95          name = "TestIPConfiguration"
    96          subnet_id = "${azurerm_subnet.test.id}"
    97        }
    98    }
    99  
   100    virtual_machine_storage_profile_os_disk {
   101      name = "osDiskProfile"
   102      caching       = "ReadWrite"
   103      create_option = "FromImage"
   104      vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"]
   105    }
   106  
   107    virtual_machine_storage_profile_image_reference {
   108      publisher = "Canonical"
   109      offer     = "UbuntuServer"
   110      sku       = "14.04.2-LTS"
   111      version   = "latest"
   112    }
   113  }
   114  ```
   115  
   116  ## Argument Reference
   117  
   118  The following arguments are supported:
   119  
   120  * `name` - (Required) Specifies the name of the virtual machine scale set resource. Changing this forces a
   121      new resource to be created.
   122  * `resource_group_name` - (Required) The name of the resource group in which to
   123      create the virtual machine scale set.
   124  * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
   125  * `sku` - (Required) A sku block as documented below.
   126  * `upgrade_policy_mode` - (Required) Specifies the mode of an upgrade to virtual machines in the scale set. Possible values, `Manual` or `Automatic`.
   127  * `os_profile` - (Required) A Virtual Machine OS Profile block as documented below.
   128  * `os_profile_secrets` - (Optional) A collection of Secret blocks as documented below.
   129  * `os_profile_windows_config` - (Required, when a windows machine) A Windows config block as documented below.
   130  * `os_profile_linux_config` - (Required, when a linux machine) A Linux config block as documented below.
   131  * `network_profile` - (Required) A collection of network profile block as documented below.
   132  * `storage_profile_os_disk` - (Required) A storage profile os disk block as documented below
   133  * `storage_profile_image_reference` - (Optional) A storage profile image reference block as documented below.
   134  * `tags` - (Optional) A mapping of tags to assign to the resource. 
   135  
   136  
   137  `sku` supports the following:
   138  
   139  * `name` - (Required) Specifies the size of virtual machines in a scale set.
   140  * `tier` - (Optional) Specifies the tier of virtual machines in a scale set. Possible values, `standard` or `basic`.
   141  * `capacity` - (Required) Specifies the number of virtual machines in the scale set.
   142  
   143  `os_profile` supports the following:
   144  
   145  * `computer_name_prefix` - (Required) Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long.
   146  * `admin_username` - (Required) Specifies the administrator account name to use for all the instances of virtual machines in the scale set.
   147  * `admin_password` - (Required) Specifies the administrator password to use for all the instances of virtual machines in a scale set..
   148  * `custom_data` - (Optional) Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on all the Virtual Machines in the scale set. The maximum length of the binary array is 65535 bytes.
   149  
   150  `os_profile_secrets` supports the following:
   151  
   152  * `source_vault_id` - (Required) Specifies the key vault to use.
   153  * `vault_certificates` - (Required, on windows machines) A collection of Vault Certificates as documented below
   154  
   155  `vault_certificates` support the following:
   156  
   157  * `certificate_url` - (Required) It is the Base64 encoding of a JSON Object that which is encoded in UTF-8 of which the contents need to be `data`, `dataType` and `password`.
   158  * `certificate_store` - (Required, on windows machines) Specifies the certificate store on the Virtual Machine where the certificate should be added to.
   159  
   160  
   161  `os_profile_windows_config` supports the following:
   162  
   163  * `provision_vm_agent` - (Optional) Indicates whether virtual machine agent should be provisioned on the virtual machines in the scale set.
   164  * `enable_automatic_upgrades` - (Optional) Indicates whether virtual machines in the scale set are enabled for automatic updates.
   165  * `winrm` - (Optional) A collection of WinRM configuration blocks as documented below.
   166  * `additional_unattend_config` - (Optional) An Additional Unattended Config block as documented below.
   167  
   168  `winrm` supports the following:
   169  
   170  * `protocol` - (Required) Specifies the protocol of listener
   171  * `certificate_url` - (Optional) Specifies URL of the certificate with which new Virtual Machines is provisioned.
   172  
   173  `additional_unattend_config` supports the following:
   174  
   175  * `pass` - (Required) Specifies the name of the pass that the content applies to. The only allowable value is `oobeSystem`.
   176  * `component` - (Required) Specifies the name of the component to configure with the added content. The only allowable value is `Microsoft-Windows-Shell-Setup`.
   177  * `setting_name` - (Required) Specifies the name of the setting to which the content applies. Possible values are: `FirstLogonCommands` and `AutoLogon`.
   178  * `content` - (Optional) Specifies the base-64 encoded XML formatted content that is added to the unattend.xml file for the specified path and component.
   179  
   180  `os_profile_linux_config` supports the following:
   181  
   182  * `disable_password_authentication` - (Required) Specifies whether password authentication should be disabled.
   183  * `ssh_keys` - (Optional) Specifies a collection of `path` and `key_data` to be placed on the virtual machine. 
   184  
   185  ~> **Note:** Please note that the only allowed `path` is `/home/<username>/.ssh/authorized_keys` due to a limitation of Azure_
   186  
   187  
   188  `network_profile` supports the following:
   189  
   190  * `name` - (Required) Specifies the name of the network interface configuration.
   191  * `primary` - (Required) Indicates whether network interfaces created from the network interface configuration will be the primary NIC of the VM.
   192  * `ip_configuration` - (Required) An ip_configuration block as documented below
   193  
   194  `ip_configuration` supports the following:
   195  
   196  * `name` - (Required) Specifies name of the IP configuration.
   197  * `subnet_id` - (Required) Specifies the identifier of the subnet.
   198  * `load_balancer_backend_address_pool_ids` - (Optional) Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer.
   199  
   200  `storage_profile_os_disk` supports the following:
   201  
   202  * `name` - (Required) Specifies the disk name.
   203  * `vhd_containers` - (Required) Specifies the vhd uri.
   204  * `create_option` - (Required) Specifies how the virtual machine should be created. The only possible option is `FromImage`.
   205  * `caching` - (Required) Specifies the caching requirements.
   206  * `image` - (Optional) Specifies the blob uri for user image. A virtual machine scale set creates an os disk in the same container as the user image.
   207                         Updating the osDisk image causes the existing disk to be deleted and a new one created with the new image. If the VM scale set is in Manual upgrade mode then the virtual machines are not updated until they have manualUpgrade applied to them.
   208  * `os_type` - (Optional) Specifies the operating system Type, valid values are windows, linux.
   209  
   210  `storage_profile_image_reference` supports the following:
   211  
   212  * `publisher` - (Required) Specifies the publisher of the image used to create the virtual machines
   213  * `offer` - (Required) Specifies the offer of the image used to create the virtual machines.
   214  * `sku` - (Required) Specifies the SKU of the image used to create the virtual machines.
   215  * `version` - (Optional) Specifies the version of the image used to create the virtual machines.
   216  
   217  ## Attributes Reference
   218  
   219  The following attributes are exported:
   220  
   221  * `id` - The virtual machine scale set ID.