Terraform module which creates EIPs and associate them with other resources on Alibaba Cloud
terraform-alicloud-eip
English | 简体中文
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:
For Terraform 0.12.
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"
}
}
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 = []
}
]
}
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 = []
}
]
}
This Module provides a variety of templates for creating EIP instances and associate them with other resource instances to meet different usage scenarios, like:
- 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.
Created and maintained by Zhou qilin([email protected]), He Guimin(@xiaozhu36, [email protected])
Apache 2 Licensed. See LICENSE for full details.