Skip to content

Commit

Permalink
Add tags to alb listener (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcincuber authored May 14, 2021
1 parent 19b7765 commit a0eed4b
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
rev: v3.4.0
hooks:
- id: check-added-large-files
args: ['--maxkb=500']
Expand All @@ -18,7 +18,7 @@ repos:
args: ['--allow-missing-credentials']
- id: trailing-whitespace
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.45.0
rev: v1.50.0
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
<a name="unreleased"></a>
## [Unreleased]

- Remove lb name's postfix and update examples
- Update README.md


<a name="2.0.0"></a>
## [2.0.0] - 2020-12-10

- Remove lb name's postfix and update examples ([#5](https://github.com/umotif-public/terraform-aws-alb/issues/5))


<a name="1.2.2"></a>
Expand Down Expand Up @@ -52,7 +58,8 @@ All notable changes to this project will be documented in this file.
- Add default redirect and nlb example


[Unreleased]: https://github.com/umotif-public/terraform-aws-alb/compare/1.2.2...HEAD
[Unreleased]: https://github.com/umotif-public/terraform-aws-alb/compare/2.0.0...HEAD
[2.0.0]: https://github.com/umotif-public/terraform-aws-alb/compare/1.2.2...2.0.0
[1.2.2]: https://github.com/umotif-public/terraform-aws-alb/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/umotif-public/terraform-aws-alb/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/umotif-public/terraform-aws-alb/compare/1.1.0...1.2.0
Expand Down
86 changes: 48 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ These types of resources are supported:

## Terraform versions

Terraform 0.12. Pin module version to `~> v2.0`. Submit pull-requests to `master` branch.
Terraform 0.12. Pin module version to `~> v2.1`. Submit pull-requests to `master` branch.

## Usage

Expand All @@ -20,7 +20,7 @@ Terraform 0.12. Pin module version to `~> v2.0`. Submit pull-requests to `master
```hcl
module "alb" {
source = "umotif-public/alb/aws"
version = "~> 2.0.0"
version = "~> 2.1.0"
name_prefix = "complete-alb"
Expand All @@ -45,7 +45,7 @@ module "alb" {
```hcl
module "nlb" {
source = "umotif-public/alb/aws"
version = "~> 2.0.0"
version = "~> 2.1.0"
name_prefix = "complete-nlb"
Expand All @@ -64,10 +64,6 @@ module "nlb" {
}
```

## Assumptions

Module is to be used with Terraform > 0.12.

## Examples

* [Application Load Balancer ALB](https://github.com/umotif-public/terraform-aws-alb/tree/master/examples/alb)
Expand All @@ -76,58 +72,72 @@ Module is to be used with Terraform > 0.12.

## Authors

Module managed by [Marcin Cuber](https://github.com/marcincuber) [linkedin](https://www.linkedin.com/in/marcincuber/).
Module managed by [Marcin Cuber](https://github.com/marcincuber) [LinkedIn](https://www.linkedin.com/in/marcincuber/).

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

| Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.45 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.6 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.40 |

## Providers

| Name | Version |
|------|---------|
| aws | >= 2.45 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.40 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_lb.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb) | resource |
| [aws_lb_listener.frontend_http_to_https_redirect](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener) | resource |
| [aws_security_group.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_security_group_rule.allow_port_443_ingress_for_http_to_https_redirect](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [aws_security_group_rule.allow_port_80_ingress_for_http_to_https_redirect](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [aws_security_group_rule.egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| access\_logs | An Access Logs block. | `map(string)` | `{}` | no |
| cidr\_blocks\_redirect | List of CIDR ranges to allow at security group level. Defaults to 0.0.0.0/0 | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| description | The description of the all resources. | `string` | `"Managed by Terraform"` | no |
| enable\_cross\_zone\_load\_balancing | If true, cross-zone load balancing of the load balancer will be enabled. This is a network load balancer feature. | `bool` | `false` | no |
| enable\_deletion\_protection | If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer. | `bool` | `false` | no |
| enable\_http2 | Indicates whether HTTP/2 is enabled in application load balancers. | `bool` | `true` | no |
| enable\_http\_to\_https\_redirect | Enable default redirect rule from port 80 to 443. | `bool` | `false` | no |
| idle\_timeout | (Optional) The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type application. | `number` | `60` | no |
| internal | Provision an internal load balancer. Defaults to false. | `bool` | `false` | no |
| ip\_address\_type | The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack. | `string` | `"ipv4"` | no |
| load\_balancer\_create\_timeout | Timeout value when creating the ALB. | `string` | `"15m"` | no |
| load\_balancer\_delete\_timeout | Timeout value when deleting the ALB. | `string` | `"15m"` | no |
| load\_balancer\_type | Type of load balancer to provision (network or application). | `string` | `"application"` | no |
| load\_balancer\_update\_timeout | Timeout value when updating the ALB. | `string` | `"15m"` | no |
| name\_prefix | A prefix used for naming resources. | `string` | n/a | yes |
| subnet\_mapping | A list of subnet mapping blocks describing subnets to attach to network load balancer | `list(map(string))` | `[]` | no |
| subnets | A list of subnet IDs to attach to the LB. | `list(string)` | n/a | yes |
| tags | A map of tags (key-value pairs) passed to resources. | `map(string)` | `{}` | no |
| vpc\_id | The VPC ID. | `string` | n/a | yes |
| <a name="input_access_logs"></a> [access\_logs](#input\_access\_logs) | An Access Logs block. | `map(string)` | `{}` | no |
| <a name="input_cidr_blocks_redirect"></a> [cidr\_blocks\_redirect](#input\_cidr\_blocks\_redirect) | List of CIDR ranges to allow at security group level. Defaults to 0.0.0.0/0 | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| <a name="input_description"></a> [description](#input\_description) | The description of the all resources. | `string` | `"Managed by Terraform"` | no |
| <a name="input_enable_cross_zone_load_balancing"></a> [enable\_cross\_zone\_load\_balancing](#input\_enable\_cross\_zone\_load\_balancing) | If true, cross-zone load balancing of the load balancer will be enabled. This is a network load balancer feature. | `bool` | `false` | no |
| <a name="input_enable_deletion_protection"></a> [enable\_deletion\_protection](#input\_enable\_deletion\_protection) | If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer. | `bool` | `false` | no |
| <a name="input_enable_http2"></a> [enable\_http2](#input\_enable\_http2) | Indicates whether HTTP/2 is enabled in application load balancers. | `bool` | `true` | no |
| <a name="input_enable_http_to_https_redirect"></a> [enable\_http\_to\_https\_redirect](#input\_enable\_http\_to\_https\_redirect) | Enable default redirect rule from port 80 to 443. | `bool` | `false` | no |
| <a name="input_idle_timeout"></a> [idle\_timeout](#input\_idle\_timeout) | (Optional) The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type application. | `number` | `60` | no |
| <a name="input_internal"></a> [internal](#input\_internal) | Provision an internal load balancer. Defaults to false. | `bool` | `false` | no |
| <a name="input_ip_address_type"></a> [ip\_address\_type](#input\_ip\_address\_type) | The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack. | `string` | `"ipv4"` | no |
| <a name="input_load_balancer_create_timeout"></a> [load\_balancer\_create\_timeout](#input\_load\_balancer\_create\_timeout) | Timeout value when creating the ALB. | `string` | `"15m"` | no |
| <a name="input_load_balancer_delete_timeout"></a> [load\_balancer\_delete\_timeout](#input\_load\_balancer\_delete\_timeout) | Timeout value when deleting the ALB. | `string` | `"15m"` | no |
| <a name="input_load_balancer_type"></a> [load\_balancer\_type](#input\_load\_balancer\_type) | Type of load balancer to provision (network or application). | `string` | `"application"` | no |
| <a name="input_load_balancer_update_timeout"></a> [load\_balancer\_update\_timeout](#input\_load\_balancer\_update\_timeout) | Timeout value when updating the ALB. | `string` | `"15m"` | no |
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | A prefix used for naming resources. | `string` | n/a | yes |
| <a name="input_subnet_mapping"></a> [subnet\_mapping](#input\_subnet\_mapping) | A list of subnet mapping blocks describing subnets to attach to network load balancer | `list(map(string))` | `[]` | no |
| <a name="input_subnets"></a> [subnets](#input\_subnets) | A list of subnet IDs to attach to the LB. | `list(string)` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags (key-value pairs) passed to resources. | `map(string)` | `{}` | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The VPC ID. | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| arn | The ARN of the load balancer. |
| arn\_suffix | The ARN suffix for use with CloudWatch Metrics. |
| dns\_name | The DNS name of the load balancer. |
| name | The name of the load balancer. |
| origin\_id | First part of the DNS name of the load balancer. |
| security\_group\_id | The ID of the security group. |
| zone\_id | The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record). |

| <a name="output_arn"></a> [arn](#output\_arn) | The ARN of the load balancer. |
| <a name="output_arn_suffix"></a> [arn\_suffix](#output\_arn\_suffix) | The ARN suffix for use with CloudWatch Metrics. |
| <a name="output_dns_name"></a> [dns\_name](#output\_dns\_name) | The DNS name of the load balancer. |
| <a name="output_name"></a> [name](#output\_name) | The name of the load balancer. |
| <a name="output_origin_id"></a> [origin\_id](#output\_origin\_id) | First part of the DNS name of the load balancer. |
| <a name="output_security_group_id"></a> [security\_group\_id](#output\_security\_group\_id) | The ID of the security group. |
| <a name="output_zone_id"></a> [zone\_id](#output\_zone\_id) | The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record). |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## License
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ resource "aws_lb_listener" "frontend_http_to_https_redirect" {
status_code = "HTTP_301"
}
}

tags = var.tags
}

resource "aws_security_group" "main" {
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ terraform {
required_version = ">= 0.12.6"

required_providers {
aws = ">= 2.45"
aws = ">= 3.40"
}
}

0 comments on commit a0eed4b

Please sign in to comment.