github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/website/source/docs/providers/azure/r/instance.html.markdown (about)

     1  ---
     2  layout: "azure"
     3  page_title: "Azure: azure_instance"
     4  sidebar_current: "docs-azure-resource-instance"
     5  description: |-
     6    Creates a hosted service, role and deployment and then creates a virtual machine in the deployment based on the specified configuration.
     7  ---
     8  
     9  # azure\_instance
    10  
    11  Creates a hosted service, role and deployment and then creates a virtual
    12  machine in the deployment based on the specified configuration.
    13  
    14  ## Example Usage
    15  
    16  ```
    17  resource "azure_hosted_service" "terraform-service" {
    18      name = "terraform-service"
    19      location = "North Europe"
    20      ephemeral_contents = false
    21      description = "Hosted service created by Terraform."
    22      label = "tf-hs-01"
    23  }
    24  
    25  resource "azure_instance" "web" {
    26      name = "terraform-test"
    27      hosted_service_name = "${azure_hosted_service.terraform-service.name}"
    28      image = "Ubuntu Server 14.04 LTS"
    29      size = "Basic_A1"
    30      storage_service_name = "yourstorage"
    31      location = "West US"
    32      username = "terraform"
    33      password = "Pass!admin123"
    34      domain_name = "contoso.com"
    35      domain_ou = "OU=Servers,DC=contoso.com,DC=Contoso,DC=com"
    36      domain_username = "Administrator"
    37      domain_password = "Pa$$word123"
    38  
    39      endpoint {
    40          name = "SSH"
    41          protocol = "tcp"
    42          public_port = 22
    43          private_port = 22
    44      }
    45  }
    46  ```
    47  
    48  ## Argument Reference
    49  
    50  The following arguments are supported:
    51  
    52  * `name` - (Required) The name of the instance. Changing this forces a new
    53      resource to be created.
    54  
    55  * `hosted_service_name` - (Optional) The name of the hosted service the
    56      instance should be deployed under. If not provided; it will default to the
    57      value of `name`. Changes to this parameter forces the creation of a new
    58      resource.
    59  
    60  * `description` - (Optional) The description for the associated hosted service.
    61      Changing this forces a new resource to be created (defaults to the instance
    62      name).
    63  
    64  * `image` - (Required) The name of an existing VM or OS image to use for this
    65      instance. Changing this forces a new resource to be created.
    66  
    67  * `size` - (Required) The size of the instance.
    68  
    69  * `subnet` - (Optional) The name of the subnet to connect this instance to. If
    70      a value is supplied `virtual_network` is required. Changing this forces a
    71      new resource to be created.
    72  
    73  * `virtual_network` - (Optional) The name of the virtual network the `subnet`
    74      belongs to. If a value is supplied `subnet` is required. Changing this
    75      forces a new resource to be created.
    76  
    77  * `storage_service_name` - (Optional) The name of an existing storage account
    78      within the subscription which will be used to store the VHDs of this
    79      instance. Changing this forces a new resource to be created. **A Storage
    80      Service is required if you are using a Platform Image**
    81  
    82  * `reverse_dns` - (Optional) The DNS address to which the IP address of the
    83      hosted service resolves when queried using a reverse DNS query. Changing
    84      this forces a new resource to be created.
    85  
    86  * `location` - (Required) The location/region where the cloud service is
    87      created. Changing this forces a new resource to be created.
    88  
    89  * `automatic_updates` - (Optional) If true this will enable automatic updates.
    90      This attribute is only used when creating a Windows instance. Changing this
    91      forces a new resource to be created (defaults false)
    92  
    93  * `time_zone` - (Optional) The appropriate time zone for this instance in the
    94      format 'America/Los_Angeles'. This attribute is only used when creating a
    95      Windows instance. Changing this forces a new resource to be created
    96      (defaults false)
    97  
    98  * `username` - (Required) The username of a new user that will be created while
    99      creating the instance. Changing this forces a new resource to be created.
   100  
   101  * `password` - (Optional) The password of the new user that will be created
   102      while creating the instance. Required when creating a Windows instance or
   103      when not supplying an `ssh_key_thumbprint` while creating a Linux instance.
   104      Changing this forces a new resource to be created.
   105  
   106  * `ssh_key_thumbprint` - (Optional) The SSH thumbprint of an existing SSH key
   107      within the subscription. This attribute is only used when creating a Linux
   108      instance. Changing this forces a new resource to be created.
   109  
   110  * `security_group` - (Optional) The Network Security Group to associate with
   111      this instance.
   112  
   113  * `endpoint` - (Optional) Can be specified multiple times to define multiple
   114      endpoints. Each `endpoint` block supports fields documented below.
   115  
   116  * `domain_name` - (Optional) The name of an Active Directory domain to join.
   117  
   118  * `domain_ou` - (Optional) Specifies the LDAP Organizational Unit to place the 
   119      instance in.
   120  
   121  * `domain_username` - (Optional) The username of an account with permission to
   122      join the instance to the domain. Required if a domain_name is specified.
   123  
   124  * `domain_password` - (Optional) The password for the domain_username account
   125      specified above.
   126  
   127  
   128  The `endpoint` block supports:
   129  
   130  * `name` - (Required) The name of the external endpoint.
   131  
   132  * `protocol` - (Optional) The transport protocol for the endpoint. Valid
   133      options are: `tcp` and `udp` (defaults `tcp`)
   134  
   135  * `public_port` - (Required) The external port to use for the endpoint.
   136  
   137  * `private_port` - (Required) The private port on which the instance is
   138      listening.
   139  
   140  ## Attributes Reference
   141  
   142  The following attributes are exported:
   143  
   144  * `id` - The instance ID.
   145  * `description` - The description for the associated hosted service.
   146  * `subnet` - The subnet the instance is connected to.
   147  * `endpoint` - The complete set of configured endpoints.
   148  * `security_group` - The associated Network Security Group.
   149  * `ip_address` - The private IP address assigned to the instance.
   150  * `vip_address` - The public IP address assigned to the instance.