Skip to content

Commit

Permalink
Feature/updates (#2)
Browse files Browse the repository at this point in the history
* Update docs + lock versions and add changelog

* Update changelog

* update hooks
  • Loading branch information
marcincuber authored Apr 21, 2020
1 parent 4cd062b commit 0c22da0
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 25 deletions.
111 changes: 111 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Change Log

All notable changes to this project will be documented in this file.

{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]
{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
{{/* SKIPPING RULES - START */ -}}
{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
{{- if not (contains .Subject "[ci skip]") -}}
{{- if not (contains .Subject "[skip ci]") -}}
{{- if not (hasPrefix .Subject "Merge pull request ") -}}
{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
{{- /* SKIPPING RULES - END */ -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{/* SKIPPING RULES - START */ -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{/* SKIPPING RULES - END */ -}}
{{ end }}
{{ end -}}
{{ else }}
{{ range .Unreleased.Commits -}}
{{/* SKIPPING RULES - START */ -}}
{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
{{- if not (contains .Subject "[ci skip]") -}}
{{- if not (contains .Subject "[skip ci]") -}}
{{- if not (hasPrefix .Subject "Merge pull request ") -}}
{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
{{- /* SKIPPING RULES - END */ -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{/* SKIPPING RULES - START */ -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{/* SKIPPING RULES - END */ -}}
{{ end }}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ if .CommitGroups -}}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
{{/* SKIPPING RULES - START */ -}}
{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
{{- if not (contains .Subject "[ci skip]") -}}
{{- if not (contains .Subject "[skip ci]") -}}
{{- if not (hasPrefix .Subject "Merge pull request ") -}}
{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
{{- /* SKIPPING RULES - END */ -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{/* SKIPPING RULES - START */ -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{/* SKIPPING RULES - END */ -}}
{{ end }}
{{ end -}}
{{ else }}
{{ range .Commits -}}
{{/* SKIPPING RULES - START */ -}}
{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
{{- if not (contains .Subject "[ci skip]") -}}
{{- if not (contains .Subject "[skip ci]") -}}
{{- if not (hasPrefix .Subject "Merge pull request ") -}}
{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
{{- /* SKIPPING RULES - END */ -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{/* SKIPPING RULES - START */ -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{/* SKIPPING RULES - END */ -}}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
10 changes: 10 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/umotif-public/terraform-aws-alb
options:
header:
pattern: "^(.*)$"
pattern_maps:
- Subject
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
args: ['--allow-missing-credentials']
- id: trailing-whitespace
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.25.0
rev: v1.29.0
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Change Log

All notable changes to this project will be documented in this file.

<a name="unreleased"></a>
## [Unreleased]

- Update docs + lock versions and add changelog
- add git hooks and update docs
- update docs


<a name="1.1.0"></a>
## [1.1.0] - 2019-12-20

- fix sg issues and add redirect 443 ingres


<a name="1.0.4"></a>
## [1.0.4] - 2019-12-19

- add docs generation and update README


<a name="1.0.3"></a>
## [1.0.3] - 2019-12-17

- Add default security group ingress when redirect is enabled


<a name="1.0.2"></a>
## 1.0.2 - 2019-12-12

- Add default redirect and nlb example


[Unreleased]: https://github.com/umotif-public/terraform-aws-alb/compare/1.1.0...HEAD
[1.1.0]: https://github.com/umotif-public/terraform-aws-alb/compare/1.0.4...1.1.0
[1.0.4]: https://github.com/umotif-public/terraform-aws-alb/compare/1.0.3...1.0.4
[1.0.3]: https://github.com/umotif-public/terraform-aws-alb/compare/1.0.2...1.0.3
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ifneq (,)
.error This Makefile requires GNU Make.
endif

.PHONY: hooks validate
.PHONY: hooks validate changelog

help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Expand All @@ -14,3 +14,6 @@ hooks: ## Commit hooks setup

validate: ## Validate files with pre-commit hooks
@pre-commit run --all-files

changelog:
git-chglog -o CHANGELOG.md
62 changes: 39 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Terraform 0.12. Pin module version to `~> v1.0`. Submit pull-requests to `master
```hcl
module "alb" {
source = "umotif-public/alb/aws"
version = "~> 1.0"
version = "~> 1.2.0"
name_prefix = "complete-alb"
Expand All @@ -43,7 +43,7 @@ module "alb" {
```hcl
module "nlb" {
source = "umotif-public/alb/aws"
version = "~> 1.0"
version = "~> 1.2.0"
name = "complete-nlb"
Expand Down Expand Up @@ -76,29 +76,42 @@ Module is to be used with Terraform > 0.12.
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 |

## Providers

| Name | Version |
|------|---------|
| aws | ~> 2.45 |

## 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) | `[ "0.0.0.0/0" ]` | 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 |
|------|-------------|------|---------|:--------:|
| 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 |

## Outputs

Expand All @@ -110,7 +123,7 @@ Module managed by [Marcin Cuber](https://github.com/marcincuber) [linkedin](http
| 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\). |
| 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 -->

Expand All @@ -130,5 +143,8 @@ See LICENSE for full details.

```bash
brew install pre-commit terraform-docs tflint

brew tap git-chglog/git-chglog
brew install git-chglog
```

7 changes: 7 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = "~> 0.12.6"

required_providers {
aws = "~> 2.45"
}
}

0 comments on commit 0c22da0

Please sign in to comment.