-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Creating loadbalancer module * Upd version * Changes loadbalancer * Adding l4 and l7 conf * Description
- Loading branch information
1 parent
3219b7f
commit bcdcfa3
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
resource "opentelekomcloud_lb_loadbalancer_v3" "elb" { | ||
name = "${var.name}-lb" | ||
router_id = var.vpc_id | ||
network_ids = [var.subnet_id] | ||
|
||
availability_zones = var.availability_zones | ||
l4_flavor = var.l4_flavor | ||
l7_flavor = var.l7_flavor | ||
|
||
public_ip { | ||
id = opentelekomcloud_vpc_eip_v1.ingress_eip.id | ||
} | ||
} | ||
|
||
resource "opentelekomcloud_vpc_eip_v1" "ingress_eip" { | ||
bandwidth { | ||
charge_mode = "traffic" | ||
name = "${var.name}-ingress-bandwidth" | ||
share_type = "PER" | ||
size = var.bandwidth | ||
} | ||
publicip { | ||
type = "5_bgp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
output "elb_id" { | ||
value = opentelekomcloud_lb_loadbalancer_v3.elb.id | ||
} | ||
|
||
output "elb_private_ip" { | ||
value = opentelekomcloud_lb_loadbalancer_v3.elb.vip_address | ||
} | ||
|
||
output "elb_public_ip" { | ||
value = opentelekomcloud_vpc_eip_v1.ingress_eip.publicip[0].ip_address | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_version = "v1.3.7" | ||
required_providers { | ||
opentelekomcloud = { | ||
source = "opentelekomcloud/opentelekomcloud" | ||
version = "1.36.1" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
variable "name" { | ||
type = string | ||
description = "Project name." | ||
} | ||
|
||
variable "bandwidth" { | ||
type = number | ||
default = 300 | ||
description = "The bandwidth size. The value ranges from 1 to 1000 Mbit/s." | ||
} | ||
|
||
variable "vpc_id" { | ||
type = string | ||
description = "VPC where the elastic load balancer will be created." | ||
} | ||
|
||
variable "subnet_id" { | ||
type = string | ||
description = "Subnets where the elastic load balancer will be created." | ||
} | ||
|
||
variable "availability_zones" { | ||
type = list(string) | ||
description = "Specifies the availability zones where the LoadBalancer will be located." | ||
} | ||
|
||
variable "l4_flavor" { | ||
type = string | ||
description = "The flavor for the L4(NLB) ELB, if not assigned and L7 also not assigned then both will be created with default values" | ||
default = null | ||
} | ||
|
||
variable "l7_flavor" { | ||
type = string | ||
description = "The flavor for the L7(ALB) ELB, if not assigned and L4 also not assigned then both will be created with default values" | ||
default = null | ||
} |