terraform-alicloud-eip
Terraform module which creates EIPs and associate them with other resources on Alibaba CloudEnglish | 简体中文
Terraform module can create EIP instances on Alibaba Cloud and associate them with other resources, like ECS Instance, SLB, Nat Gateway and Network Interface.
These types of resources are supported:
Terraform versions
For Terraform 0.12.
Usage
Create several EIP instances
module "eip" {
source = "terraform-alicloud-modules/eip/alicloud"
region = "cn-hangzhou"
create = true
number_of_eips = 5
name = "my-eip"
description = "An EIP associated with ECS instance."
bandwidth = 5
internet_charge_type = "PayByTraffic"
instance_charge_type = "PostPaid"
period = 1
resource_group_id = "eip-12345678"
tags = {
Env = "Private"
Location = "foo"
}
}
Create several EIPs and associate with other instances
NOTE: There is no need to specify number_of_eips
.
module "eip" {
source = "terraform-alicloud-modules/eip/alicloud"
region = "cn-hangzhou"
create = true
name = "ecs-eip"
description = "An EIP associated with ECS instance."
bandwidth = 5
internet_charge_type = "PayByTraffic"
instance_charge_type = "PostPaid"
period = 1
resource_group_id = "eip-12345678"
// Associate with ecs and slb
instances = [
{
instance_ids = ["i-g2q7r8g32h", "i-bcuie3h3oixxxx", "i-bceier3"]
instance_type = "EcsInstance"
private_ips = ["172.16.0.1", "172.16.0.2", "172.16.0.3"]
},
{
instance_ids = ["slb-45678", "slb-gg8uer3"]
instance_type = "SlbInstance"
private_ips = []
}
]
}
Create several EIPs and associate with other computed instances
NOTE: There is no need to specify number_of_eips
.
// Create several ECS instances
module "ecs" {
source = "alibaba/ecs-instance/alicloud"
version = "~> 2.0"
region = "cn-hangzhou"
number_of_instances = 3
name = "my-ecs-cluster"
use_num_suffix = true
# omitted...
}
module "eip" {
source = "terraform-alicloud-modules/eip/alicloud"
region = "cn-hangzhou"
create = true
name = "ecs-eip"
description = "An EIP associated with ECS instance."
bandwidth = 5
internet_charge_type = "PayByTraffic"
instance_charge_type = "PostPaid"
period = 1
resource_group_id = "eip-12345678"
# The number of instances created by other modules
number_of_computed_instances = 2
computed_instances = [
{
instance_ids = module.ecs.this_instance_id
instance_type = "EcsInstance"
private_ips = []
}
]
}
Modules
This Module provides a variety of templates for creating EIP instances and associate them with other resource instances to meet different usage scenarios, like:
Examples
Notes
- This module using AccessKey and SecretKey are from
profile
andshared_credentials_file
. If you have not set them yet, please install aliyun-cli and configure it.
Submit Issues
If you have any problems when using this module, please opening a provider issue and let us know.
Note: There does not recommend to open an issue on this repo.
Authors
Created and maintained by Zhou qilin(z17810666992@163.com), He Guimin(@xiaozhu36, heguimin36@163.com)
License
Apache 2 Licensed. See LICENSE for full details.