github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/alicloud/index.html.markdown (about)

     1  ---
     2  layout: "alicloud"
     3  page_title: "Provider: alicloud"
     4  sidebar_current: "docs-alicloud-index"
     5  description: |-
     6    The Alicloud provider is used to interact with many resources supported by Alicloud. The provider needs to be configured with the proper credentials before it can be used.
     7  ---
     8  
     9  # Alicloud Provider
    10  
    11  The Alicloud provider is used to interact with the
    12  many resources supported by [Alicloud](https://www.aliyun.com). The provider needs to be configured
    13  with the proper credentials before it can be used.
    14  
    15  Use the navigation to the left to read about the available resources.
    16  
    17  ## Example Usage
    18  
    19  ```hcl
    20  # Configure the Alicloud Provider
    21  provider "alicloud" {
    22    access_key = "${var.access_key}"
    23    secret_key = "${var.secret_key}"
    24    region     = "${var.region}"
    25  }
    26  
    27  # Create a web server
    28  resource "alicloud_instance" "web" {
    29    # cn-beijing
    30    provider          = "alicloud"
    31    availability_zone = "cn-beijing-b"
    32    image_id          = "ubuntu_140405_32_40G_cloudinit_20161115.vhd"
    33  
    34    instance_network_type = "Classic"
    35    internet_charge_type  = "PayByBandwidth"
    36  
    37    instance_type        = "ecs.n1.medium"
    38    io_optimized         = "optimized"
    39    system_disk_category = "cloud_efficiency"
    40    security_groups      = ["${alicloud_security_group.default.id}"]
    41    instance_name        = "web"
    42  }
    43  
    44  # Create security group
    45  resource "alicloud_security_group" "default" {
    46    name        = "default"
    47    provider    = "alicloud"
    48    description = "default"
    49  }
    50  ```
    51  
    52  ## Authentication
    53  
    54  The Alicloud provider offers a flexible means of providing credentials for authentication.
    55  The following methods are supported, in this order, and explained below:
    56  
    57  - Static credentials
    58  - Environment variables
    59  
    60  ### Static credentials ###
    61  
    62  Static credentials can be provided by adding an `access_key` `secret_key` and `region` in-line in the
    63  alicloud provider block:
    64  
    65  Usage:
    66  
    67  ```hcl
    68  provider "alicloud" {
    69    access_key = "${var.access_key}"
    70    secret_key = "${var.secret_key}"
    71    region     = "${var.region}"
    72  }
    73  ```
    74  
    75  
    76  ###Environment variables
    77  
    78  You can provide your credentials via `ALICLOUD_ACCESS_KEY` and `ALICLOUD_SECRET_KEY`,
    79  environment variables, representing your Alicloud Access Key and Secret Key, respectively.
    80  `ALICLOUD_REGION` is also used, if applicable:
    81  
    82  ```hcl
    83  provider "alicloud" {}
    84  ```
    85  
    86  Usage:
    87  
    88  ```shell
    89  $ export ALICLOUD_ACCESS_KEY="anaccesskey"
    90  $ export ALICLOUD_SECRET_KEY="asecretkey"
    91  $ export ALICLOUD_REGION="cn-beijing"
    92  $ terraform plan
    93  ```
    94  
    95  
    96  ## Argument Reference
    97  
    98  The following arguments are supported:
    99  
   100  * `access_key` - (Optional) This is the Alicloud access key. It must be provided, but
   101    it can also be sourced from the `ALICLOUD_ACCESS_KEY` environment variable.
   102  
   103  * `secret_key` - (Optional) This is the Alicloud secret key. It must be provided, but
   104    it can also be sourced from the `ALICLOUD_SECRET_KEY` environment variable.
   105  
   106  * `region` - (Required) This is the Alicloud region. It must be provided, but
   107    it can also be sourced from the `ALICLOUD_REGION` environment variables.
   108  
   109  
   110  ## Testing
   111  
   112  Credentials must be provided via the `ALICLOUD_ACCESS_KEY`, and `ALICLOUD_SECRET_KEY` environment variables in order to run acceptance tests.