github.com/pbthorste/terraform@v0.8.6-0.20170127005045-deb56bd93da2/website/source/docs/providers/alicloud/r/eip_association.html.markdown (about)

     1  ---
     2  layout: "alicloud"
     3  page_title: "Alicloud: alicloud_eip_association"
     4  sidebar_current: "docs-alicloud-resource-eip-association"
     5  description: |-
     6    Provides a ECS EIP Association resource.
     7  ---
     8  
     9  # alicloud\_eip\_association
    10  
    11  Provides an Alicloud EIP Association resource, to associate and disassociate Elastic IPs from ECS Instances.
    12  
    13  ~> **NOTE:** `alicloud_eip_association` is useful in scenarios where EIPs are either
    14   pre-existing or distributed to customers or users and therefore cannot be changed.
    15   In addition, it only supports ECS-VPC.
    16  
    17  ## Example Usage
    18  
    19  ```
    20  # Create a new EIP association and use it to associate a EIP form a instance.
    21  
    22  resource "alicloud_vpc" "vpc" {
    23      cidr_block = "10.1.0.0/21"
    24  }
    25  
    26  resource "alicloud_vswitch" "vsw" {
    27      vpc_id = "${alicloud_vpc.vpc.id}"
    28      cidr_block = "10.1.1.0/24"
    29      availability_zone = "cn-beijing-a"
    30      depends_on = [
    31      "alicloud_vpc.vpc"]
    32  }
    33  
    34  resource "alicloud_instance" "ecs_instance" {
    35      image_id = "ubuntu_140405_64_40G_cloudinit_20161115.vhd"
    36      instance_type = "ecs.s1.small"
    37      availability_zone = "cn-beijing-a"
    38      security_groups = ["${alicloud_security_group.group.id}"]
    39      vswitch_id = "${alicloud_vswitch.vsw.id}"
    40      instance_name = "hello"
    41      instance_network_type = "vpc"
    42  
    43      tags {
    44          Name = "TerraformTest-instance"
    45      }
    46  }
    47  
    48  resource "alicloud_eip" "eip" {
    49  }
    50  
    51  resource "alicloud_eip_association" "eip_asso" {
    52      allocation_id = "${alicloud_eip.eip.id}"
    53      instance_id = "${alicloud_instance.ecs_instance.id}"
    54  }
    55  
    56  resource "alicloud_security_group" "group" {
    57      name = "terraform-test-group"
    58      description = "New security group"
    59      vpc_id = "${alicloud_vpc.vpc.id}"
    60  }
    61  ```
    62  
    63  ## Argument Reference
    64  
    65  The following arguments are supported:
    66  
    67  * `allocation_id` - (Optional, Forces new resource) The allocation EIP ID.
    68  * `instance_id` - (Optional, Forces new resource) The ID of the instance.
    69  
    70  ## Attributes Reference
    71  
    72  The following attributes are exported:
    73  
    74  * `allocation_id` - As above.
    75  * `instance_id` - As above.