Skip to content

Commit

Permalink
Upgraded module to support Terraform 0.12 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbabenko authored Jun 12, 2019
1 parent 0d48cbd commit ca8497c
Show file tree
Hide file tree
Showing 17 changed files with 239 additions and 177 deletions.
51 changes: 51 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]
{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ else }}
{{ range .Unreleased.Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ 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 -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ else }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ 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/terraform-aws-modules/terraform-aws-sqs
options:
header:
pattern: "^(.*)$"
pattern_maps:
- Subject
6 changes: 3 additions & 3 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.7.3
rev: v1.12.0
hooks:
- id: terraform_fmt
- id: terraform_docs
# - id: terraform_docs
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
rev: v2.2.3
hooks:
- id: check-merge-conflict
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<a name="unreleased"></a>
## [Unreleased]



<a name="v2.0.0"></a>
## [v2.0.0] - 0001-01-01



<a name="v1.2.1"></a>
## [v1.2.1] - 2018-06-05

- Create SQS queues correctly (fixes [#4](https://github.com/terraform-aws-modules/terraform-aws-sqs/issues/4))


<a name="v1.2.0"></a>
## [v1.2.0] - 2018-06-04

- Merge pull request [#3](https://github.com/terraform-aws-modules/terraform-aws-sqs/issues/3) from terraform-aws-modules/fix-kms-queues
- Fix usage of KMS key in count


<a name="v1.1.0"></a>
## [v1.1.0] - 2018-05-16

- Added pre-commit hook to autogenerate terraform-docs


<a name="v1.0.0"></a>
## [v1.0.0] - 2018-02-23

- Fixed conditional creation rule
- Changed default value for content_based_deduplication to false
- Fixed styling
- Added sqs module


<a name="v0.0.2"></a>
## [v0.0.2] - 2017-09-26



<a name="v0.0.1"></a>
## v0.0.1 - 2017-09-26

- Initial commit
- Initial commit


[Unreleased]: https://github.com/terraform-aws-modules/terraform-aws-sqs/compare/v2.0.0...HEAD
[v2.0.0]: https://github.com/terraform-aws-modules/terraform-aws-sqs/compare/v1.2.1...v2.0.0
[v1.2.1]: https://github.com/terraform-aws-modules/terraform-aws-sqs/compare/v1.2.0...v1.2.1
[v1.2.0]: https://github.com/terraform-aws-modules/terraform-aws-sqs/compare/v1.1.0...v1.2.0
[v1.1.0]: https://github.com/terraform-aws-modules/terraform-aws-sqs/compare/v1.0.0...v1.1.0
[v1.0.0]: https://github.com/terraform-aws-modules/terraform-aws-sqs/compare/v0.0.2...v1.0.0
[v0.0.2]: https://github.com/terraform-aws-modules/terraform-aws-sqs/compare/v0.0.1...v0.0.2
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: changelog release

changelog:
git-chglog -o CHANGELOG.md --next-tag `semtag final -s minor -o`

release:
semtag final -s minor
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ These types of resources are supported:

* [SQS queue](https://www.terraform.io/docs/providers/aws/r/sqs_queue.html) with optional [server-side encryption using KMS](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html)

## Terraform versions

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

Terraform 0.11. Pin module version to `~> v1.0`. Submit pull-requests to `terraform011` branch.

## Usage

```hcl
module "user_queue" {
source = "terraform-aws-modules/sqs/aws"
source = "terraform-aws-modules/sqs/aws"
version = "~> 2.0"
name = "user"
Expand All @@ -23,8 +30,7 @@ module "user_queue" {

## Examples

* [Simple SQS queue](https://github.com/terraform-aws-modules/terraform-aws-sqs/tree/master/examples/simple-sqs)
* [SQS queue with KMS encryption](https://github.com/terraform-aws-modules/terraform-aws-sqs/tree/master/examples/sqs-with-kms)
* [SQS queues with server-side encryption (SSE) using KMS and without SSE](https://github.com/terraform-aws-modules/terraform-aws-sqs/tree/master/examples/complete-sqs)

## Conditional creation

Expand All @@ -33,7 +39,8 @@ Sometimes you need to have a way to create SQS queue conditionally but Terraform
```hcl
# This SQS queue will not be created
module "user_queue" {
source = "terraform-aws-modules/sqs/aws"
source = "terraform-aws-modules/sqs/aws"
version = "~> 2.0"
create = false
# ... omitted
Expand All @@ -58,7 +65,6 @@ module "user_queue" {
| policy | The JSON policy for the SQS queue | string | `` | no |
| receive_wait_time_seconds | The time for which a ReceiveMessage call will wait for a message to arrive (long polling) before returning. An integer from 0 to 20 (seconds) | string | `0` | no |
| redrive_policy | The JSON policy to set up the Dead Letter Queue, see AWS docs. Note: when specifying maxReceiveCount, you must specify it as an integer (5), and not a string ("5") | string | `` | no |
| sqs_queue_with_kms | Whether to create SQS queue with KMS encryption | string | `false` | no |
| tags | A mapping of tags to assign to all resources | string | `<map>` | no |
| visibility_timeout_seconds | The visibility timeout for the queue. An integer from 0 to 43200 (12 hours) | string | `30` | no |

Expand Down
11 changes: 2 additions & 9 deletions examples/simple-sqs/README.md → examples/complete/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Simple SQS queue example
# Complete SQS queues example

Configuration in this directory creates simple SQS queues.
Configuration in this directory creates 2 SQS queues - with server-side encryption (SSE) using specified KMS key and without SSE.

## Usage

Expand All @@ -16,11 +16,4 @@ Note that this example may create resources which cost money. Run `terraform des

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

## Outputs

| Name | Description |
|------|-------------|
| this_sqs_queue_arn | The ARN of the SQS queue |
| this_sqs_queue_id | The URL for the created Amazon SQS queue |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
27 changes: 27 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
provider "aws" {
region = "eu-west-1"
}

resource "aws_kms_key" "this" {}

module "users_unencrypted" {
source = "../../"

name = "users-unencrypted"

tags = {
Secure = "false"
}
}

module "users_encrypted" {
source = "../../"

name_prefix = "users-encrypted-"

kms_master_key_id = aws_kms_key.this.id

tags = {
Secure = "true"
}
}
19 changes: 19 additions & 0 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
output "users_unencrypted_this_sqs_queue_id" {
description = "The URL for the created Amazon SQS queue"
value = module.users_unencrypted.this_sqs_queue_id
}

output "users_unencrypted_this_sqs_queue_arn" {
description = "The ARN of the SQS queue"
value = module.users_unencrypted.this_sqs_queue_arn
}

output "users_encrypted_this_sqs_queue_id" {
description = "The URL for the created Amazon SQS queue"
value = module.users_encrypted.this_sqs_queue_id
}

output "users_encrypted_this_sqs_queue_arn" {
description = "The ARN of the SQS queue"
value = module.users_encrypted.this_sqs_queue_arn
}
28 changes: 0 additions & 28 deletions examples/simple-sqs/main.tf

This file was deleted.

9 changes: 0 additions & 9 deletions examples/simple-sqs/outputs.tf

This file was deleted.

28 changes: 0 additions & 28 deletions examples/sqs-with-kms/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions examples/sqs-with-kms/main.tf

This file was deleted.

19 changes: 0 additions & 19 deletions examples/sqs-with-kms/outputs.tf

This file was deleted.

Loading

0 comments on commit ca8497c

Please sign in to comment.