Skip to content

Commit

Permalink
Feature/updates (#3)
Browse files Browse the repository at this point in the history
* update docs and add chglog

* Add CHANGELOG.md
  • Loading branch information
marcincuber authored Apr 22, 2020
1 parent 466a61f commit 537f6d4
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 31 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-elasticache-redis
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
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Change Log

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

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

- update docs and add chglog
- add git hooks and update docs
- Update README.md


<a name="1.0.2"></a>
## [1.0.2] - 2020-01-03

- improve typing ([#1](https://github.com/umotif-public/terraform-aws-elasticache-redis/issues/1))


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

- add support for custom sg and notification_topic_arn


<a name="1.0.0"></a>
## 1.0.0 - 2019-12-19

- add redis configuration
- Initial commit of docs


[Unreleased]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/1.0.2...HEAD
[1.0.2]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/umotif-public/terraform-aws-elasticache-redis/compare/1.0.0...1.0.1
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
99 changes: 70 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

A Terraform module to create an AWS Redis ElastiCache cluster

## Resources created


## Terraform versions

Terraform 0.12. Pin module version to `~> v1.0`. Submit pull-requests to `master` branch.
Expand All @@ -14,8 +11,39 @@ Terraform 0.12. Pin module version to `~> v1.0`. Submit pull-requests to `master
```hcl
module "redis" {
source = "umotif-public/elasticache-redis/aws"
version = "~> 1.0"
version = "~> 1.0.0"
name_prefix = "core-example"
number_cache_clusters = 2
node_type = "cache.t3.small"
engine_version = "5.0.6"
port = 6379
maintenance_window = "mon:03:00-mon:04:00"
snapshot_window = "04:00-06:00"
snapshot_retention_limit = 7
automatic_failover_enabled = true
at_rest_encryption_enabled = true
transit_encryption_enabled = true
auth_token = "1234567890asdfghjkl"
apply_immediately = true
family = "redis5.0"
description = "Test elasticache redis."
subnet_ids = module.vpc.private_subnets
vpc_id = module.vpc.vpc_id
ingress_cidr_blocks = ["0.0.0.0/0"]
parameter = [
{
name = "repl-backlog-size"
value = "16384"
}
]
tags = {
Project = "Test"
Expand All @@ -36,34 +64,44 @@ 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

No requirements.

## Providers

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

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| apply\_immediately | Specifies whether any modifications are applied immediately, or during the next maintenance window. | bool | `"false"` | no |
| at\_rest\_encryption\_enabled | Whether to enable encryption at rest. | bool | `"true"` | no |
| auth\_token | The password used to access a password protected server. Can be specified only if `transit\_encryption\_enabled = true`. | string | `""` | no |
| auto\_minor\_version\_upgrade | | string | `"true"` | no |
| automatic\_failover\_enabled | Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. | bool | `"true"` | no |
| description | The description of the all resources. | string | `"Managed by Terraform"` | no |
| engine\_version | The version number of the cache engine to be used for the cache clusters in this replication group. | string | `"5.0.6"` | no |
| family | The family of the ElastiCache parameter group. | string | `"redis5.0"` | no |
| ingress\_cidr\_blocks | List of Ingress CIDR blocks. | list(string) | `[]` | no |
| kms\_key\_id | The ARN of the key that you wish to use if encrypting at rest. If not supplied, uses service managed encryption. Can be specified only if `at\_rest\_encryption\_enabled = true` | string | `""` | no |
| maintenance\_window | Specifies the weekly time range for when maintenance on the cache cluster is performed. | string | `""` | no |
| name\_prefix | The replication group identifier. This parameter is stored as a lowercase string. | string | n/a | yes |
| node\_type | The compute and memory capacity of the nodes in the node group. | string | n/a | yes |
| notification\_topic\_arn | An Amazon Resource Name \(ARN\) of an SNS topic to send ElastiCache notifications to. Example: `arn:aws:sns:us-east-1:012345678999:my\_sns\_topic` | string | `""` | no |
| number\_cache\_clusters | The number of cache clusters \(primary and replicas\) this replication group will have. | number | n/a | yes |
| parameter | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | object | `[]` | no |
| port | The port number on which each of the cache nodes will accept connections. | number | `"6379"` | no |
| security\_group\_ids | List of Security Groups. | list(string) | `[]` | no |
| snapshot\_retention\_limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. | number | `"30"` | no |
| snapshot\_window | The daily time range \(in UTC\) during which ElastiCache will begin taking a daily snapshot of your cache cluster. | string | `""` | no |
| subnet\_ids | List of VPC Subnet IDs for the cache subnet group. | list(string) | n/a | yes |
| tags | A mapping of tags to assign to all resources. | map(string) | `{}` | no |
| transit\_encryption\_enabled | Whether to enable encryption in transit. | bool | `"true"` | no |
| vpc\_id | VPC Id to associate with Redis ElastiCache. | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| apply\_immediately | Specifies whether any modifications are applied immediately, or during the next maintenance window. | `bool` | `false` | no |
| at\_rest\_encryption\_enabled | Whether to enable encryption at rest. | `bool` | `true` | no |
| auth\_token | The password used to access a password protected server. Can be specified only if `transit_encryption_enabled = true`. | `string` | `""` | no |
| auto\_minor\_version\_upgrade | n/a | `string` | `true` | no |
| automatic\_failover\_enabled | Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. | `bool` | `true` | no |
| description | The description of the all resources. | `string` | `"Managed by Terraform"` | no |
| engine\_version | The version number of the cache engine to be used for the cache clusters in this replication group. | `string` | `"5.0.6"` | no |
| family | The family of the ElastiCache parameter group. | `string` | `"redis5.0"` | no |
| ingress\_cidr\_blocks | List of Ingress CIDR blocks. | `list(string)` | `[]` | no |
| kms\_key\_id | The ARN of the key that you wish to use if encrypting at rest. If not supplied, uses service managed encryption. Can be specified only if `at_rest_encryption_enabled = true` | `string` | `""` | no |
| maintenance\_window | Specifies the weekly time range for when maintenance on the cache cluster is performed. | `string` | `""` | no |
| name\_prefix | The replication group identifier. This parameter is stored as a lowercase string. | `string` | n/a | yes |
| node\_type | The compute and memory capacity of the nodes in the node group. | `string` | n/a | yes |
| notification\_topic\_arn | An Amazon Resource Name (ARN) of an SNS topic to send ElastiCache notifications to. Example: `arn:aws:sns:us-east-1:012345678999:my_sns_topic` | `string` | `""` | no |
| number\_cache\_clusters | The number of cache clusters (primary and replicas) this replication group will have. | `number` | n/a | yes |
| parameter | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
| port | The port number on which each of the cache nodes will accept connections. | `number` | `6379` | no |
| security\_group\_ids | List of Security Groups. | `list(string)` | `[]` | no |
| snapshot\_retention\_limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. | `number` | `30` | no |
| snapshot\_window | The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. | `string` | `""` | no |
| subnet\_ids | List of VPC Subnet IDs for the cache subnet group. | `list(string)` | n/a | yes |
| tags | A mapping of tags to assign to all resources. | `map(string)` | `{}` | no |
| transit\_encryption\_enabled | Whether to enable encryption in transit. | `bool` | `true` | no |
| vpc\_id | VPC Id to associate with Redis ElastiCache. | `string` | n/a | yes |

## Outputs

Expand Down Expand Up @@ -101,4 +139,7 @@ See LICENSE for full details.

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

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

0 comments on commit 537f6d4

Please sign in to comment.