github.com/simonswine/terraform@v0.9.0-beta2/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_storage_account" "test" {
    36    name                = "accsa"
    37    resource_group_name = "${azurerm_resource_group.test.name}"
    38    location            = "westus"
    39    account_type        = "Standard_LRS"
    40  
    41    tags {
    42      environment = "staging"
    43    }
    44  }
    45  
    46  resource "azurerm_storage_container" "test" {
    47    name                  = "vhds"
    48    resource_group_name   = "${azurerm_resource_group.test.name}"
    49    storage_account_name  = "${azurerm_storage_account.test.name}"
    50    container_access_type = "private"
    51  }
    52  
    53  resource "azurerm_virtual_machine_scale_set" "test" {
    54    name                = "mytestscaleset-1"
    55    location            = "West US"
    56    resource_group_name = "${azurerm_resource_group.test.name}"
    57    upgrade_policy_mode = "Manual"
    58  
    59    sku {
    60      name     = "Standard_A0"
    61      tier     = "Standard"
    62      capacity = 2
    63    }
    64  
    65    os_profile {
    66      computer_name_prefix = "testvm"
    67      admin_username       = "myadmin"
    68      admin_password       = "Passwword1234"
    69    }
    70  
    71    os_profile_linux_config {
    72      disable_password_authentication = true
    73  
    74      ssh_keys {
    75        path     = "/home/myadmin/.ssh/authorized_keys"
    76        key_data = "${file("~/.ssh/demo_key.pub")}"
    77      }
    78    }
    79  
    80    network_profile {
    81      name    = "TestNetworkProfile"
    82      primary = true
    83  
    84      ip_configuration {
    85        name      = "TestIPConfiguration"
    86        subnet_id = "${azurerm_subnet.test.id}"
    87      }
    88    }
    89  
    90    storage_profile_os_disk {
    91      name           = "osDiskProfile"
    92      caching        = "ReadWrite"
    93      create_option  = "FromImage"
    94      vhd_containers = ["${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}"]
    95    }
    96  
    97    storage_profile_image_reference {
    98      publisher = "Canonical"
    99      offer     = "UbuntuServer"
   100      sku       = "14.04.2-LTS"
   101      version   = "latest"
   102    }
   103  }
   104  ```
   105  
   106  ## Argument Reference
   107  
   108  The following arguments are supported:
   109  
   110  * `name` - (Required) Specifies the name of the virtual machine scale set resource. Changing this forces a
   111      new resource to be created.
   112  * `resource_group_name` - (Required) The name of the resource group in which to
   113      create the virtual machine scale set.
   114  * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
   115  * `sku` - (Required) A sku block as documented below.
   116  * `upgrade_policy_mode` - (Required) Specifies the mode of an upgrade to virtual machines in the scale set. Possible values, `Manual` or `Automatic`.
   117  * `overprovision` - (Optional) Specifies whether the virtual machine scale set should be overprovisioned.
   118  * `os_profile` - (Required) A Virtual Machine OS Profile block as documented below.
   119  * `os_profile_secrets` - (Optional) A collection of Secret blocks as documented below.
   120  * `os_profile_windows_config` - (Required, when a windows machine) A Windows config block as documented below.
   121  * `os_profile_linux_config` - (Required, when a linux machine) A Linux config block as documented below.
   122  * `network_profile` - (Required) A collection of network profile block as documented below.
   123  * `storage_profile_os_disk` - (Required) A storage profile os disk block as documented below
   124  * `storage_profile_image_reference` - (Optional) A storage profile image reference block as documented below.
   125  * `tags` - (Optional) A mapping of tags to assign to the resource.
   126  
   127  
   128  `sku` supports the following:
   129  
   130  * `name` - (Required) Specifies the size of virtual machines in a scale set.
   131  * `tier` - (Optional) Specifies the tier of virtual machines in a scale set. Possible values, `standard` or `basic`.
   132  * `capacity` - (Required) Specifies the number of virtual machines in the scale set.
   133  
   134  `os_profile` supports the following:
   135  
   136  * `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.
   137  * `admin_username` - (Required) Specifies the administrator account name to use for all the instances of virtual machines in the scale set.
   138  * `admin_password` - (Required) Specifies the administrator password to use for all the instances of virtual machines in a scale set..
   139  * `custom_data` - (Optional) Specifies custom data to supply to the machine. On linux-based systems, this can be used as a cloud-init script. On other systems, this will be copied as a file on disk. Internally, Terraform will base64 encode this value before sending it to the API. The maximum length of the binary array is 65535 bytes.
   140  
   141  `os_profile_secrets` supports the following:
   142  
   143  * `source_vault_id` - (Required) Specifies the key vault to use.
   144  * `vault_certificates` - (Required, on windows machines) A collection of Vault Certificates as documented below
   145  
   146  `vault_certificates` support the following:
   147  
   148  * `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`.
   149  * `certificate_store` - (Required, on windows machines) Specifies the certificate store on the Virtual Machine where the certificate should be added to.
   150  
   151  
   152  `os_profile_windows_config` supports the following:
   153  
   154  * `provision_vm_agent` - (Optional) Indicates whether virtual machine agent should be provisioned on the virtual machines in the scale set.
   155  * `enable_automatic_upgrades` - (Optional) Indicates whether virtual machines in the scale set are enabled for automatic updates.
   156  * `winrm` - (Optional) A collection of WinRM configuration blocks as documented below.
   157  * `additional_unattend_config` - (Optional) An Additional Unattended Config block as documented below.
   158  
   159  `winrm` supports the following:
   160  
   161  * `protocol` - (Required) Specifies the protocol of listener
   162  * `certificate_url` - (Optional) Specifies URL of the certificate with which new Virtual Machines is provisioned.
   163  
   164  `additional_unattend_config` supports the following:
   165  
   166  * `pass` - (Required) Specifies the name of the pass that the content applies to. The only allowable value is `oobeSystem`.
   167  * `component` - (Required) Specifies the name of the component to configure with the added content. The only allowable value is `Microsoft-Windows-Shell-Setup`.
   168  * `setting_name` - (Required) Specifies the name of the setting to which the content applies. Possible values are: `FirstLogonCommands` and `AutoLogon`.
   169  * `content` - (Optional) Specifies the base-64 encoded XML formatted content that is added to the unattend.xml file for the specified path and component.
   170  
   171  `os_profile_linux_config` supports the following:
   172  
   173  * `disable_password_authentication` - (Required) Specifies whether password authentication should be disabled.
   174  * `ssh_keys` - (Optional) Specifies a collection of `path` and `key_data` to be placed on the virtual machine.
   175  
   176  ~> **Note:** Please note that the only allowed `path` is `/home/<username>/.ssh/authorized_keys` due to a limitation of Azure_
   177  
   178  
   179  `network_profile` supports the following:
   180  
   181  * `name` - (Required) Specifies the name of the network interface configuration.
   182  * `primary` - (Required) Indicates whether network interfaces created from the network interface configuration will be the primary NIC of the VM.
   183  * `ip_configuration` - (Required) An ip_configuration block as documented below
   184  
   185  `ip_configuration` supports the following:
   186  
   187  * `name` - (Required) Specifies name of the IP configuration.
   188  * `subnet_id` - (Required) Specifies the identifier of the subnet.
   189  * `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.
   190  
   191  `storage_profile_os_disk` supports the following:
   192  
   193  * `name` - (Required) Specifies the disk name.
   194  * `vhd_containers` - (Optional) Specifies the vhd uri. This property is ignored if using a custom image.
   195  * `create_option` - (Required) Specifies how the virtual machine should be created. The only possible option is `FromImage`.
   196  * `caching` - (Required) Specifies the caching requirements.
   197  * `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.
   198                         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.
   199                         If this property is set then vhd_containers is ignored.
   200  * `os_type` - (Optional) Specifies the operating system Type, valid values are windows, linux.
   201  
   202  `storage_profile_image_reference` supports the following:
   203  
   204  * `publisher` - (Required) Specifies the publisher of the image used to create the virtual machines
   205  * `offer` - (Required) Specifies the offer of the image used to create the virtual machines.
   206  * `sku` - (Required) Specifies the SKU of the image used to create the virtual machines.
   207  * `version` - (Optional) Specifies the version of the image used to create the virtual machines.
   208  
   209  ## Attributes Reference
   210  
   211  The following attributes are exported:
   212  
   213  * `id` - The virtual machine scale set ID.