From 0c22da0c9f5b97fc916e1a4d64c52528eaed521d Mon Sep 17 00:00:00 2001 From: Marcin Cuber Date: Tue, 21 Apr 2020 16:08:09 +0100 Subject: [PATCH] Feature/updates (#2) * Update docs + lock versions and add changelog * Update changelog * update hooks --- .chglog/CHANGELOG.tpl.md | 111 +++++++++++++++++++++++++++++++++++++++ .chglog/config.yml | 10 ++++ .pre-commit-config.yaml | 2 +- CHANGELOG.md | 40 ++++++++++++++ Makefile | 5 +- README.md | 62 ++++++++++++++-------- versions.tf | 7 +++ 7 files changed, 212 insertions(+), 25 deletions(-) create mode 100644 .chglog/CHANGELOG.tpl.md create mode 100644 .chglog/config.yml create mode 100644 CHANGELOG.md create mode 100644 versions.tf diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100644 index 0000000..9c56fa4 --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,111 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +{{ if .Versions -}} + +## [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 }} + +## {{ 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 -}} \ No newline at end of file diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100644 index 0000000..b8b9882 --- /dev/null +++ b/.chglog/config.yml @@ -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 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ed0e86a..0a26a19 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..53cae51 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log + +All notable changes to this project will be documented in this file. + + +## [Unreleased] + +- Update docs + lock versions and add changelog +- add git hooks and update docs +- update docs + + + +## [1.1.0] - 2019-12-20 + +- fix sg issues and add redirect 443 ingres + + + +## [1.0.4] - 2019-12-19 + +- add docs generation and update README + + + +## [1.0.3] - 2019-12-17 + +- Add default security group ingress when redirect is enabled + + + +## 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 diff --git a/Makefile b/Makefile index e992c54..fdd8a32 100644 --- a/Makefile +++ b/Makefile @@ -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}' @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index e08e041..5a654be 100644 --- a/README.md +++ b/README.md @@ -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" @@ -43,7 +43,7 @@ module "alb" { ```hcl module "nlb" { source = "umotif-public/alb/aws" - version = "~> 1.0" + version = "~> 1.2.0" name = "complete-nlb" @@ -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/). +## 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)` |
[
"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 | ## Outputs @@ -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). | @@ -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 ``` diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..853683b --- /dev/null +++ b/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = "~> 0.12.6" + + required_providers { + aws = "~> 2.45" + } +}