Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tf_mod_aws_elb
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
steamhaus
tf_mod_aws_elb
Commits
a4e0268c
Commit
a4e0268c
authored
Oct 20, 2016
by
A-Gordon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
0 deletions
+179
-0
.gitlab-ci.yaml
.gitlab-ci.yaml
+12
-0
README.md
README.md
+9
-0
main.tf
main.tf
+158
-0
No files found.
.gitlab-ci.yaml
0 → 100644
View file @
a4e0268c
image
:
alpine:latest
variables
:
TERRAFORM_URL
:
"
https://releases.hashicorp.com/terraform/0.7.1/terraform_0.7.1_linux_amd64.zip"
before_script
:
-
apk update && apk add ca-certificates && update-ca-certificates && apk add openssl
-
wget -O /tmp/terraform.zip $TERRAFORM_URL
-
unzip /tmp/terraform.zip -d /usr/local/bin
test
:
script
:
terraform validate
README.md
0 → 100644
View file @
a4e0268c
module "elb" {
source = "../../../../steamhaus/tf_mod_aws_elb"
elb_name = "${var.name}-elb"
subnets =
[
"${module.vpc.public_subnets}"
]
security_groups =
[
"${aws_security_group.elb.id}"
]
health_check_target = "HTTP:80/healthcheck.php"
ssl_certificate_id = "arn:aws:acm:eu-west-1:745249840871:certificate/b6ad625c-d0b8-4359-bcb6-326b309e90e8"
}
\ No newline at end of file
main.tf
0 → 100644
View file @
a4e0268c
#############################################################################################################
# Variables
#############################################################################################################
variable
"name"
{
description
=
"Name of the ELB"
}
variable
"vpc_id"
{
description
=
"ID of the VPC in which the ELB should reside"
}
variable
"internal"
{
description
=
"Determines if the ELB is internal or not"
default
=
false
}
variable
"subnets"
{
type
=
"list"
}
variable
"cross_zone_load_balancing"
{
default
=
"true"
}
variable
"idle_timeout"
{
default
=
"60"
}
variable
"connection_draining"
{
default
=
"true"
}
variable
"connection_draining_timeout"
{
default
=
"30"
}
# Listener variables
variable
"service_protocol"
{
description
=
"The protocol the backend service speaks"
default
=
"http"
}
variable
"service_port"
{
description
=
"The port the service on the EC2 instances listens on"
default
=
"80"
}
variable
"lb_port"
{
default
=
"443"
}
variable
"lb_protocol"
{
default
=
"https"
}
variable
"elb_cert"
{}
# Health check variables
variable
"health_check_healthy_threshold"
{
default
=
"2"
}
variable
"health_check_unhealthy_threshold"
{
default
=
"2"
}
variable
"health_check_timeout"
{
default
=
"3"
}
variable
"health_check_target"
{}
variable
"health_check_interval"
{
default
=
"30"
}
#############################################################################################################
# Security Group
#############################################################################################################
resource
"aws_security_group"
"main"
{
name
=
"
${
var
.
name
}
-elb"
description
=
"Allows traffic to elb from other security groups"
vpc_id
=
"
${
var
.
vpc_id
}
"
ingress
{
from_port
=
80
to_port
=
80
protocol
=
-
1
cidr_blocks
=
[
"0.0.0.0/0"
]
}
ingress
{
from_port
=
443
to_port
=
443
protocol
=
-
1
cidr_blocks
=
[
"0.0.0.0/0"
]
}
egress
{
from_port
=
0
to_port
=
0
protocol
=
-
1
cidr_blocks
=
[
"0.0.0.0/0"
]
}
}
#############################################################################################################
# ELB
#############################################################################################################
resource
"aws_elb"
"main"
{
name
=
"
${
var
.
name
}
"
internal
=
"
${
var
.
internal
}
"
subnets
=
[
"
${
var
.
subnets
}
"
]
security_groups
=
[
"
${
aws_security_group
.
main
.
id
}
"
]
cross_zone_load_balancing
=
"
${
var
.
cross_zone_load_balancing
}
"
idle_timeout
=
"
${
var
.
idle_timeout
}
"
connection_draining
=
"
${
var
.
connection_draining
}
"
connection_draining_timeout
=
"
${
var
.
connection_draining_timeout
}
"
listener
{
lb_port
=
"80"
lb_protocol
=
"http"
instance_port
=
"
${
var
.
service_port
}
"
instance_protocol
=
"
${
var
.
service_protocol
}
"
}
listener
{
lb_port
=
"443"
lb_protocol
=
"https"
ssl_certificate_id
=
"
${
var
.
elb_cert
}
"
instance_port
=
"
${
var
.
service_port
}
"
instance_protocol
=
"
${
var
.
service_protocol
}
"
}
health_check
{
healthy_threshold
=
"
${
var
.
health_check_healthy_threshold
}
"
unhealthy_threshold
=
"
${
var
.
health_check_unhealthy_threshold
}
"
timeout
=
"
${
var
.
health_check_timeout
}
"
target
=
"
${
var
.
health_check_target
}
"
interval
=
"
${
var
.
health_check_interval
}
"
}
}
#############################################################################################################
# Outputs
#############################################################################################################
output
"name"
{
value
=
"
${
aws_elb
.
main
.
name
}
"
}
output
"dns_name"
{
value
=
"
${
aws_elb
.
main
.
dns_name
}
"
}
output
"zone_id"
{
value
=
"
${
aws_elb
.
main
.
zone_id
}
"
}
output
"security_group"
{
value
=
"
${
aws_security_group
.
main
.
id
}
"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment