Skip to content

Latest commit

 

History

History
76 lines (63 loc) · 4.93 KB

README.md

File metadata and controls

76 lines (63 loc) · 4.93 KB

AWS Application Load Balancer (ALB) Module

This module creates Application Type of AWS Elastic Load Balancer (ELB) with Security Group, HTTP and HTTPS Listeners attached to it.

Example

# main.tf
module "alb" {
  source = "git::https://github.com/lpavliuk/Terraform-Modules.git//aws_elb_app"

  name                  = local.codename
  vpc_id                = local.vpc_id
  subnet_ids            = local.subnet_group_subnets_ids
  https_certificate_arn = local.public_domain_certificate_arn
  extra_sg_ids          = [ local.vpc_sg_id ]
  is_private            = false
  waf_acl_arn           = local.waf_arn

  enable_deletion_protection = true
}

Requirements

Name Version
terraform < 2.0.0, >= 1.6.6
aws < 6.0, >= 5.22

Inputs

Name Description Type Default Required
name ALB Name string n/a yes
vpc_id VPC ID the ALB will be created in string n/a yes
subnet_ids Subnet IDs the ALB will be attached to list(string) n/a yes
enable_logging Enable the ALB traffic logging to S3 bucket bool false no
enable_deletion_protection Enable the deletion protection of the ALB bool false no
is_private Enable private mode of the ALB (accessible only from VPC) bool false no
preserve_host_header Enable Preserve Host Header mode of the ALB bool false no
xff_header_processing_mode XFF Header Processing mode of the ALB string "append" no
https_certificate_arn ACM Certificate ARN for HTTPS Listener string n/a yes
extra_sg_ids Additional Security Group IDs attached to the ALB except for default Security Group list(string) [] no
waf_acl_arn ARN of the WAF attached to the ALB (enables WAF) string "" no

Outputs

Name Description
arn ALB ARN
name ALB Name
dns_name ALB DNS Name
zone_id Zone ID the ALB provisioned in
http_listener_arn ARN of the HTTP Listener attached to the ALB
https_listener_arn ARN of the HTTPS Listener attached to the ALB
waf_acl_arn ARN of AWS WAF ACL attached to the ALB
security_group_id Security Group ID of the ALB

Resources

Name Type
aws_lb.this resource
aws_lb_listener.http resource
aws_lb_listener.https resource
aws_s3_bucket.alb_logs resource
aws_s3_bucket_policy.allow_elb_logging resource
aws_security_group.this resource
aws_wafv2_web_acl_association.this resource
aws_elb_service_account.main data source
aws_iam_policy_document.allow_alb_logging data source