mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 22:34:56 -04:00
parent
a6d201b761
commit
130c61ffcf
10 changed files with 612 additions and 0 deletions
48
terraform/aws/modules/load_balancer/main.tf
Normal file
48
terraform/aws/modules/load_balancer/main.tf
Normal file
|
@ -0,0 +1,48 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 4.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_lb" "front_end" {
|
||||
name = var.name
|
||||
internal = false
|
||||
load_balancer_type = "network"
|
||||
subnets = [var.subnet]
|
||||
|
||||
tags = {
|
||||
Name = "loadbalancer"
|
||||
}
|
||||
|
||||
enable_cross_zone_load_balancing = true
|
||||
}
|
||||
|
||||
resource "aws_lb_target_group" "front_end" {
|
||||
name = var.name
|
||||
port = var.port
|
||||
protocol = "TCP"
|
||||
vpc_id = var.vpc
|
||||
|
||||
health_check {
|
||||
port = var.port
|
||||
protocol = "TCP"
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_lb_listener" "front_end" {
|
||||
load_balancer_arn = aws_lb.front_end.arn
|
||||
port = var.port
|
||||
protocol = "TCP"
|
||||
|
||||
default_action {
|
||||
type = "forward"
|
||||
target_group_arn = aws_lb_target_group.front_end.arn
|
||||
}
|
||||
}
|
3
terraform/aws/modules/load_balancer/output.tf
Normal file
3
terraform/aws/modules/load_balancer/output.tf
Normal file
|
@ -0,0 +1,3 @@
|
|||
output "target_group_arn" {
|
||||
value = aws_lb_target_group.front_end.arn
|
||||
}
|
19
terraform/aws/modules/load_balancer/variables.tf
Normal file
19
terraform/aws/modules/load_balancer/variables.tf
Normal file
|
@ -0,0 +1,19 @@
|
|||
variable "name" {
|
||||
type = string
|
||||
description = "Name of the load balancer."
|
||||
}
|
||||
|
||||
variable "port" {
|
||||
type = string
|
||||
description = "Port of the load balancer."
|
||||
}
|
||||
|
||||
variable "vpc" {
|
||||
type = string
|
||||
description = "ID of the VPC."
|
||||
}
|
||||
|
||||
variable "subnet" {
|
||||
type = string
|
||||
description = "ID of the subnets."
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue