Skip to content

Commit

Permalink
Start reworking manual test cases as examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Nemetz committed Mar 14, 2018
1 parent 2bc8f91 commit fa5327c
Show file tree
Hide file tree
Showing 27 changed files with 869 additions and 513 deletions.
1 change: 1 addition & 0 deletions examples/disabled/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Module disabled
41 changes: 41 additions & 0 deletions examples/disabled/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
data "aws_vpc" "vpc" {
tags {
Env = "one"
}
}

# Look up security group
data "aws_subnet_ids" "public_subnet_ids" {
vpc_id = "${data.aws_vpc.vpc.id}"

tags {
Network = "Public"
}
}

data "aws_subnet_ids" "private_subnet_ids" {
vpc_id = "${data.aws_vpc.vpc.id}"

tags {
Network = "Private"
}
}

module "disabled" {
source = "../../"
name = "lb-disabled"
environment = "one"
organization = "wiser"
enabled = false
instance_http_ports = "80,8080"
instance_https_ports = "443"
instance_tcp_ports = ""
lb_http_ports = "80,8080"
lb_https_ports = "443"
lb_protocols = ["HTTP", "HTTPS"]
lb_tcp_ports = ""
ports = "3000,4000"
security_groups = ["sg-bef0a5c2"] # Need at least 1
subnets = "${data.aws_subnet_ids.private_subnet_ids.ids}"
vpc_id = "${data.aws_vpc.vpc.id}"
}
122 changes: 122 additions & 0 deletions examples/disabled/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//
// LB attributes
//
output "arn" {
description = "ARN of the LB itself. Useful for debug output, for example when attaching a WAF."
value = "${module.disabled.arn}"
}

output "dns_name" {
description = "The DNS name of the LB presumably to be used with a friendlier CNAME."
value = "${module.disabled.dns_name}"
}

output "id" {
description = "The ID of the LB we created."
value = "${module.disabled.id}"
}

output "zone_id" {
description = "The zone_id of the LB to assist with creating DNS records."
value = "${module.disabled.zone_id}"
}

# arn_suffix
# canonical_hosted_zone_id

//
// LB Listener attributes
//
output "listener_http_arns" {
description = "The ARNs of the HTTP LB Listeners"
value = "${module.disabled.listener_http_arns}"
}

output "listener_http_ids" {
description = "The IDs of the HTTP LB Listeners"
value = "${module.disabled.listener_http_ids}"
}

output "listener_https_arns" {
description = "The ARNs of the HTTPS LB Listeners"
value = "${module.disabled.listener_https_arns}"
}

output "listener_https_ids" {
description = "The IDs of the HTTPS LB Listeners"
value = "${module.disabled.listener_https_ids}"
}

output "listener_tcp_arns" {
description = "The ARNs of the network TCP LB Listeners"
value = "${module.disabled.listener_tcp_arns}"
}

output "listener_tcp_ids" {
description = "The IDs of the network TCP LB Listeners"
value = "${module.disabled.listener_tcp_ids}"
}

output "listener_arns" {
description = "ARNs of all the LB Listeners"
value = "${module.disabled.listener_arns}"
}

output "listener_ids" {
description = "IDs of all the LB Listeners"
value = "${module.disabled.listener_ids}"
}

//
// LB Target Group attributes
//
output "target_group_http_arns" {
description = "ARNs of the HTTP target groups. Useful for passing to your Auto Scaling group module."
value = "${module.disabled.target_group_http_arns}"
}

output "target_group_https_arns" {
description = "ARNs of the HTTPS target groups. Useful for passing to your Auto Scaling group module."
value = "${module.disabled.target_group_https_arns}"
}

output "target_group_tcp_arns" {
description = "ARNs of the TCP target groups. Useful for passing to your Auto Scaling group module."
value = "${module.disabled.target_group_tcp_arns}"
}

output "target_group_arns" {
description = "ARNs of all the target groups. Useful for passing to your Auto Scaling group module."
value = "${module.disabled.target_group_arns}"
}

output "target_group_http_ids" {
description = "IDs of the HTTP target groups"
value = "${module.disabled.target_group_http_ids}"
}

output "target_group_https_ids" {
description = "IDs of the HTTPS target groups"
value = "${module.disabled.target_group_https_ids}"
}

output "target_group_tcp_ids" {
description = "IDs of the TCP target groups"
value = "${module.disabled.target_group_tcp_ids}"
}

output "target_group_ids" {
description = "IDs of all the target groups"
value = "${module.disabled.target_group_ids}"
}

# arn_suffix
# name

//
// Misc
//
output "principal_account_id" {
description = "The AWS-owned account given permissions to write your LB logs to S3."
value = "${module.disabled.principal_account_id}"
}
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions examples/http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ALB using HTTP
44 changes: 44 additions & 0 deletions examples/http/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
data "aws_vpc" "vpc" {
tags {
Env = "one"
}
}

# Look up security group
data "aws_subnet_ids" "public_subnet_ids" {
vpc_id = "${data.aws_vpc.vpc.id}"

tags {
Network = "Public"
}
}

data "aws_subnet_ids" "private_subnet_ids" {
vpc_id = "${data.aws_vpc.vpc.id}"

tags {
Network = "Private"
}
}

module "lb-http" {
source = "../../"
name = "lb-http"
environment = "one"
organization = "wiser"

#enable_deletion_protection = true
#enable_http2 = false
instance_http_ports = "80,8080"

instance_https_ports = ""
instance_tcp_ports = ""
lb_http_ports = "80,8080"
lb_https_ports = ""
lb_protocols = ["HTTP"]
lb_tcp_ports = ""
ports = "3000,4000"
security_groups = ["sg-bef0a5c2"] # Need at least 1
subnets = "${data.aws_subnet_ids.private_subnet_ids.ids}"
vpc_id = "${data.aws_vpc.vpc.id}"
}
122 changes: 122 additions & 0 deletions examples/http/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//
// LB attributes
//
output "arn" {
description = "ARN of the LB itself. Useful for debug output, for example when attaching a WAF."
value = "${module.lb-http.arn}"
}

output "dns_name" {
description = "The DNS name of the LB presumably to be used with a friendlier CNAME."
value = "${module.lb-http.dns_name}"
}

output "id" {
description = "The ID of the LB we created."
value = "${module.lb-http.id}"
}

output "zone_id" {
description = "The zone_id of the LB to assist with creating DNS records."
value = "${module.lb-http.zone_id}"
}

# arn_suffix
# canonical_hosted_zone_id

//
// LB Listener attributes
//
output "listener_http_arns" {
description = "The ARNs of the HTTP LB Listeners"
value = "${module.lb-http.listener_http_arns}"
}

output "listener_http_ids" {
description = "The IDs of the HTTP LB Listeners"
value = "${module.lb-http.listener_http_ids}"
}

output "listener_https_arns" {
description = "The ARNs of the HTTPS LB Listeners"
value = "${module.lb-http.listener_https_arns}"
}

output "listener_https_ids" {
description = "The IDs of the HTTPS LB Listeners"
value = "${module.lb-http.listener_https_ids}"
}

output "listener_tcp_arns" {
description = "The ARNs of the network TCP LB Listeners"
value = "${module.lb-http.listener_tcp_arns}"
}

output "listener_tcp_ids" {
description = "The IDs of the network TCP LB Listeners"
value = "${module.lb-http.listener_tcp_ids}"
}

output "listener_arns" {
description = "ARNs of all the LB Listeners"
value = "${module.lb-http.listener_arns}"
}

output "listener_ids" {
description = "IDs of all the LB Listeners"
value = "${module.lb-http.listener_ids}"
}

//
// LB Target Group attributes
//
output "target_group_http_arns" {
description = "ARNs of the HTTP target groups. Useful for passing to your Auto Scaling group module."
value = "${module.lb-http.target_group_http_arns}"
}

output "target_group_https_arns" {
description = "ARNs of the HTTPS target groups. Useful for passing to your Auto Scaling group module."
value = "${module.lb-http.target_group_https_arns}"
}

output "target_group_tcp_arns" {
description = "ARNs of the TCP target groups. Useful for passing to your Auto Scaling group module."
value = "${module.lb-http.target_group_tcp_arns}"
}

output "target_group_arns" {
description = "ARNs of all the target groups. Useful for passing to your Auto Scaling group module."
value = "${module.lb-http.target_group_arns}"
}

output "target_group_http_ids" {
description = "IDs of the HTTP target groups"
value = "${module.lb-http.target_group_http_ids}"
}

output "target_group_https_ids" {
description = "IDs of the HTTPS target groups"
value = "${module.lb-http.target_group_https_ids}"
}

output "target_group_tcp_ids" {
description = "IDs of the TCP target groups"
value = "${module.lb-http.target_group_tcp_ids}"
}

output "target_group_ids" {
description = "IDs of all the target groups"
value = "${module.lb-http.target_group_ids}"
}

# arn_suffix
# name

//
// Misc
//
output "principal_account_id" {
description = "The AWS-owned account given permissions to write your LB logs to S3."
value = "${module.lb-http.principal_account_id}"
}
5 changes: 5 additions & 0 deletions examples/http/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "aws" {
region = "${var.region}"

#version = "1.5"
}
3 changes: 3 additions & 0 deletions examples/http/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
variable "region" {
default = "us-west-2"
}
1 change: 1 addition & 0 deletions examples/https/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ALB using HTTPS
41 changes: 41 additions & 0 deletions examples/https/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
data "aws_vpc" "vpc" {
tags {
Env = "one"
}
}

# Look up security group
data "aws_subnet_ids" "public_subnet_ids" {
vpc_id = "${data.aws_vpc.vpc.id}"

tags {
Network = "Public"
}
}

data "aws_subnet_ids" "private_subnet_ids" {
vpc_id = "${data.aws_vpc.vpc.id}"

tags {
Network = "Private"
}
}

module "lb-https" {
source = "../../"
name = "lb-https"
environment = "one"
organization = "wiser"
instance_http_ports = ""
instance_https_ports = "443,8443"
instance_tcp_ports = ""
internal = false # PUBLIC
lb_http_ports = ""
lb_https_ports = "443,8443"
lb_protocols = ["HTTPS"]
lb_tcp_ports = ""
ports = "3000,4000"
security_groups = ["sg-bef0a5c2"] # PUBLIC -> use whitelist SG
subnets = "${data.aws_subnet_ids.public_subnet_ids.ids}" # PUBLIC -> use public subnets
vpc_id = "${data.aws_vpc.vpc.id}"
}
Loading

0 comments on commit fa5327c

Please sign in to comment.