github.com/anuaimi/terraform@v0.6.4-0.20150904235404-2bf9aec61da8/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  
    35      endpoint {
    36          name = "SSH"
    37          protocol = "tcp"
    38          public_port = 22
    39          private_port = 22
    40      }
    41  }
    42  ```
    43  
    44  ## Argument Reference
    45  
    46  The following arguments are supported:
    47  
    48  * `name` - (Required) The name of the instance. Changing this forces a new
    49      resource to be created.
    50  
    51  * `hosted_service_name` - (Optional) The name of the hosted service the
    52      instance should be deployed under. If not provided; it will default to the
    53      value of `name`. Changes to this parameter forces the creation of a new
    54      resource.
    55  
    56  * `description` - (Optional) The description for the associated hosted service.
    57      Changing this forces a new resource to be created (defaults to the instance
    58      name).
    59  
    60  * `image` - (Required) The name of an existing VM or OS image to use for this
    61      instance. Changing this forces a new resource to be created.
    62  
    63  * `size` - (Required) The size of the instance.
    64  
    65  * `subnet` - (Optional) The name of the subnet to connect this instance to. If
    66      a value is supplied `virtual_network` is required. Changing this forces a
    67      new resource to be created.
    68  
    69  * `virtual_network` - (Optional) The name of the virtual network the `subnet`
    70      belongs to. If a value is supplied `subnet` is required. Changing this
    71      forces a new resource to be created.
    72  
    73  * `storage_service_name` - (Optional) The name of an existing storage account
    74      within the subscription which will be used to store the VHDs of this
    75      instance. Changing this forces a new resource to be created. **A Storage
    76      Service is required if you are using a Platform Image**
    77  
    78  * `reverse_dns` - (Optional) The DNS address to which the IP address of the
    79      hosted service resolves when queried using a reverse DNS query. Changing
    80      this forces a new resource to be created.
    81  
    82  * `location` - (Required) The location/region where the cloud service is
    83      created. Changing this forces a new resource to be created.
    84  
    85  * `automatic_updates` - (Optional) If true this will enable automatic updates.
    86      This attribute is only used when creating a Windows instance. Changing this
    87      forces a new resource to be created (defaults false)
    88  
    89  * `time_zone` - (Optional) The appropriate time zone for this instance in the
    90      format 'America/Los_Angeles'. This attribute is only used when creating a
    91      Windows instance. Changing this forces a new resource to be created
    92      (defaults false)
    93  
    94  * `username` - (Required) The username of a new user that will be created while
    95      creating the instance. Changing this forces a new resource to be created.
    96  
    97  * `password` - (Optional) The password of the new user that will be created
    98      while creating the instance. Required when creating a Windows instance or
    99      when not supplying an `ssh_key_thumbprint` while creating a Linux instance.
   100      Changing this forces a new resource to be created.
   101  
   102  * `ssh_key_thumbprint` - (Optional) The SSH thumbprint of an existing SSH key
   103      within the subscription. This attribute is only used when creating a Linux
   104      instance. Changing this forces a new resource to be created.
   105  
   106  * `security_group` - (Optional) The Network Security Group to associate with
   107      this instance.
   108  
   109  * `endpoint` - (Optional) Can be specified multiple times to define multiple
   110      endpoints. Each `endpoint` block supports fields documented below.
   111  
   112  The `endpoint` block supports:
   113  
   114  * `name` - (Required) The name of the external endpoint.
   115  
   116  * `protocol` - (Optional) The transport protocol for the endpoint. Valid
   117      options are: `tcp` and `udp` (defaults `tcp`)
   118  
   119  * `public_port` - (Required) The external port to use for the endpoint.
   120  
   121  * `private_port` - (Required) The private port on which the instance is
   122      listening.
   123  
   124  ## Attributes Reference
   125  
   126  The following attributes are exported:
   127  
   128  * `id` - The instance ID.
   129  * `description` - The description for the associated hosted service.
   130  * `subnet` - The subnet the instance is connected to.
   131  * `endpoint` - The complete set of configured endpoints.
   132  * `security_group` - The associated Network Security Group.
   133  * `ip_address` - The private IP address assigned to the instance.
   134  * `vip_address` - The public IP address assigned to the instance.