github.com/cbroglie/terraform@v0.7.0-rc3.0.20170410193827-735dfc416d46/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 ```hcl 20 resource "alicloud_vpc" "vpc" { 21 cidr_block = "10.1.0.0/21" 22 } 23 24 resource "alicloud_vswitch" "vsw" { 25 vpc_id = "${alicloud_vpc.vpc.id}" 26 cidr_block = "10.1.1.0/24" 27 availability_zone = "cn-beijing-a" 28 29 depends_on = [ 30 "alicloud_vpc.vpc", 31 ] 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 resource "alicloud_eip_association" "eip_asso" { 51 allocation_id = "${alicloud_eip.eip.id}" 52 instance_id = "${alicloud_instance.ecs_instance.id}" 53 } 54 55 resource "alicloud_security_group" "group" { 56 name = "terraform-test-group" 57 description = "New security group" 58 vpc_id = "${alicloud_vpc.vpc.id}" 59 } 60 ``` 61 62 ## Argument Reference 63 64 The following arguments are supported: 65 66 * `allocation_id` - (Optional, Forces new resource) The allocation EIP ID. 67 * `instance_id` - (Optional, Forces new resource) The ID of the instance. 68 69 ## Attributes Reference 70 71 The following attributes are exported: 72 73 * `allocation_id` - As above. 74 * `instance_id` - As above.