Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbabenko committed Jun 19, 2020
1 parent 81f8918 commit 833ee4c
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.19.0
rev: v1.31.0
hooks:
- id: terraform_fmt
- id: terraform_docs
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v3.1.0
hooks:
- id: check-merge-conflict
42 changes: 25 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,34 @@ module "elb_http" {
* Valid SSL certificate has to be specified as `ssl_id_certificate` argument for secure listener. Use [terraform-aws-acm module](https://github.com/terraform-aws-modules/terraform-aws-acm) to create one. See [ELB example](https://github.com/terraform-aws-modules/terraform-aws-elb/blob/master/examples/complete/main.tf) for details.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

No provider.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| access\_logs | An access logs block | map(string) | `{}` | no |
| connection\_draining | Boolean to enable connection draining | bool | `"false"` | no |
| connection\_draining\_timeout | The time in seconds to allow for connections to drain | number | `"300"` | no |
| create\_elb | Create the elb or not | bool | `"true"` | no |
| cross\_zone\_load\_balancing | Enable cross-zone load balancing | bool | `"true"` | no |
| health\_check | A health check block | map(string) | n/a | yes |
| idle\_timeout | The time in seconds that the connection is allowed to be idle | number | `"60"` | no |
| instances | List of instances ID to place in the ELB pool | list(string) | `[]` | no |
| internal | If true, ELB will be an internal ELB | string | n/a | yes |
| listener | A list of listener blocks | list(map(string)) | n/a | yes |
| name | The name of the ELB | string | `"null"` | no |
| name\_prefix | The prefix name of the ELB | string | `"null"` | no |
| number\_of\_instances | Number of instances to attach to ELB | number | `"0"` | no |
| security\_groups | A list of security group IDs to assign to the ELB | list(string) | n/a | yes |
| subnets | A list of subnet IDs to attach to the ELB | list(string) | n/a | yes |
| tags | A mapping of tags to assign to the resource | map(string) | `{}` | no |
|------|-------------|------|---------|:--------:|
| access\_logs | An access logs block | `map(string)` | `{}` | no |
| connection\_draining | Boolean to enable connection draining | `bool` | `false` | no |
| connection\_draining\_timeout | The time in seconds to allow for connections to drain | `number` | `300` | no |
| create\_elb | Create the elb or not | `bool` | `true` | no |
| cross\_zone\_load\_balancing | Enable cross-zone load balancing | `bool` | `true` | no |
| health\_check | A health check block | `map(string)` | n/a | yes |
| idle\_timeout | The time in seconds that the connection is allowed to be idle | `number` | `60` | no |
| instances | List of instances ID to place in the ELB pool | `list(string)` | `[]` | no |
| internal | If true, ELB will be an internal ELB | `string` | n/a | yes |
| listener | A list of listener blocks | `list(map(string))` | n/a | yes |
| name | The name of the ELB | `string` | `null` | no |
| name\_prefix | The prefix name of the ELB | `string` | `null` | no |
| number\_of\_instances | Number of instances to attach to ELB | `number` | `0` | no |
| security\_groups | A list of security group IDs to assign to the ELB | `list(string)` | n/a | yes |
| subnets | A list of subnet IDs to attach to the ELB | `list(string)` | n/a | yes |
| tags | A mapping of tags to assign to the resource | `map(string)` | `{}` | no |

## Outputs

Expand Down
17 changes: 14 additions & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,30 @@ $ terraform apply
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| aws | n/a |
| random | n/a |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| number\_of\_instances | Number of instances to create and attach to ELB | string | `"1"` | no |
|------|-------------|------|---------|:--------:|
| number\_of\_instances | Number of instances to create and attach to ELB | `number` | `1` | no |

## Outputs

| Name | Description |
|------|-------------|
| this\_elb\_dns\_name | The DNS name of the ELB |
| this\_elb\_id | The name of the ELB |
| this\_elb\_instances | The list of instances in the ELB (if may be outdated, because instances are attached using elb_attachment resource) |
| this\_elb\_instances | The list of instances in the ELB (if may be outdated, because instances are attached using elb\_attachment resource) |
| this\_elb\_name | The name of the ELB |
| this\_elb\_source\_security\_group\_id | The ID of the security group that you can use as part of your inbound rules for your load balancer's back-end application instances |
| this\_elb\_zone\_id | The canonical hosted zone ID of the ELB (to be used in a Route 53 Alias record) |
Expand Down
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
module "elb" {
source = "./modules/elb"

create_elb = var.create_elb

name = var.name
name_prefix = var.name_prefix

Expand All @@ -20,8 +22,6 @@ module "elb" {
access_logs = var.access_logs
health_check = var.health_check

create_elb = var.create_elb

tags = merge(
var.tags,
{
Expand All @@ -36,10 +36,10 @@ module "elb" {
module "elb_attachment" {
source = "./modules/elb_attachment"

create_attachment = var.create_elb

number_of_instances = var.number_of_instances

elb = module.elb.this_elb_id
instances = var.instances

create_attachment = var.create_elb
}
40 changes: 25 additions & 15 deletions modules/elb/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
# aws_elb

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| aws | n/a |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| access\_logs | An access logs block | map(string) | `{}` | no |
| connection\_draining | Boolean to enable connection draining | bool | `"false"` | no |
| connection\_draining\_timeout | The time in seconds to allow for connections to drain | number | `"300"` | no |
| create\_elb | Create the elb or not | bool | `"true"` | no |
| cross\_zone\_load\_balancing | Enable cross-zone load balancing | bool | `"true"` | no |
| health\_check | A health check block | map(string) | n/a | yes |
| idle\_timeout | The time in seconds that the connection is allowed to be idle | number | `"60"` | no |
| internal | If true, ELB will be an internal ELB | bool | n/a | yes |
| listener | A list of listener blocks | list(map(string)) | n/a | yes |
| name | The name of the ELB | string | `"null"` | no |
| name\_prefix | The prefix name of the ELB | string | `"null"` | no |
| security\_groups | A list of security group IDs to assign to the ELB | list(string) | n/a | yes |
| subnets | A list of subnet IDs to attach to the ELB | list(string) | n/a | yes |
| tags | A mapping of tags to assign to the resource | map(string) | `{}` | no |
|------|-------------|------|---------|:--------:|
| access\_logs | An access logs block | `map(string)` | `{}` | no |
| connection\_draining | Boolean to enable connection draining | `bool` | `false` | no |
| connection\_draining\_timeout | The time in seconds to allow for connections to drain | `number` | `300` | no |
| create\_elb | Create the elb or not | `bool` | `true` | no |
| cross\_zone\_load\_balancing | Enable cross-zone load balancing | `bool` | `true` | no |
| health\_check | A health check block | `map(string)` | n/a | yes |
| idle\_timeout | The time in seconds that the connection is allowed to be idle | `number` | `60` | no |
| internal | If true, ELB will be an internal ELB | `bool` | n/a | yes |
| listener | A list of listener blocks | `list(map(string))` | n/a | yes |
| name | The name of the ELB | `string` | `null` | no |
| name\_prefix | The prefix name of the ELB | `string` | `null` | no |
| security\_groups | A list of security group IDs to assign to the ELB | `list(string)` | n/a | yes |
| subnets | A list of subnet IDs to attach to the ELB | `list(string)` | n/a | yes |
| tags | A mapping of tags to assign to the resource | `map(string)` | `{}` | no |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions modules/elb/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
resource "aws_elb" "this" {
count = var.create_elb ? 1 : 0

name = var.name
name_prefix = var.name_prefix

Expand Down Expand Up @@ -46,6 +48,4 @@ resource "aws_elb" "this" {
"Name" = format("%s", var.name)
},
)

count = var.create_elb ? 1 : 0
}
12 changes: 6 additions & 6 deletions modules/elb/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
variable "create_elb" {
description = "Create the elb or not"
type = bool
default = true
}

variable "name" {
description = "The name of the ELB"
type = string
Expand Down Expand Up @@ -70,9 +76,3 @@ variable "health_check" {
description = "A health check block"
type = map(string)
}

variable "create_elb" {
description = "Create the elb or not"
type = bool
default = true
}
24 changes: 19 additions & 5 deletions modules/elb_attachment/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# aws_elb_attachment

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| aws | n/a |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| create\_attachment | Create the elb attachment or not | bool | `"true"` | no |
| elb | The name of the ELB | string | n/a | yes |
| instances | List of instances ID to place in the ELB pool | list(string) | n/a | yes |
| number\_of\_instances | Number of instances ID to place in the ELB pool | number | n/a | yes |
|------|-------------|------|---------|:--------:|
| create\_attachment | Create the elb attachment or not | `bool` | `true` | no |
| elb | The name of the ELB | `string` | n/a | yes |
| instances | List of instances ID to place in the ELB pool | `list(string)` | n/a | yes |
| number\_of\_instances | Number of instances ID to place in the ELB pool | `number` | n/a | yes |

## Outputs

No output.

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
12 changes: 6 additions & 6 deletions modules/elb_attachment/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
variable "create_attachment" {
description = "Create the elb attachment or not"
type = bool
default = true
}

variable "number_of_instances" {
description = "Number of instances ID to place in the ELB pool"
type = number
Expand All @@ -12,9 +18,3 @@ variable "instances" {
description = "List of instances ID to place in the ELB pool"
type = list(string)
}

variable "create_attachment" {
description = "Create the elb attachment or not"
type = bool
default = true
}

0 comments on commit 833ee4c

Please sign in to comment.