Skip to content

Commit

Permalink
feat: added principals_with_send_permission var for queue
Browse files Browse the repository at this point in the history
  • Loading branch information
applike-ss committed Jan 23, 2023
1 parent 72d0db6 commit 9cb8c83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Terraform module which creates sqs queue(s)

| Name | Source | Version |
|------|--------|---------|
| <a name="module_dead"></a> [dead](#module\_dead) | github.com/justtrackio/terraform-aws-sqs-queue | v1.2.0 |
| <a name="module_queue"></a> [queue](#module\_queue) | github.com/justtrackio/terraform-aws-sqs-queue | v1.2.1 |
| <a name="module_dead"></a> [dead](#module\_dead) | justtrackio/sqs-queue/aws | 1.2.1 |
| <a name="module_queue"></a> [queue](#module\_queue) | justtrackio/sqs-queue/aws | 1.2.1 |
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |

## Resources
Expand Down Expand Up @@ -50,7 +50,7 @@ Terraform module which creates sqs queue(s)
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
| <a name="input_queues"></a> [queues](#input\_queues) | Queues to be created | <pre>map(object({<br> alarm = optional(object({<br> create = optional(bool, false)<br> datapoints_to_alarm = optional(number, 3)<br> evaluation_periods = optional(number, 3)<br> backlog_minutes = optional(number, 3)<br> period = optional(number, 60)<br> threshold = optional(number, 0)<br> }))<br> queue = object({<br> dead_letter_queue_create = optional(bool, true)<br> delay_seconds = optional(number, null)<br> fifo_queue = optional(bool, false)<br> max_receive_count = optional(number, null)<br> message_retention_seconds = optional(number, null)<br> visibility_timeout_seconds = optional(number, null)<br> })<br> subscriptions = optional(map(object({<br> enabled = optional(bool, true)<br> filter_policy = optional(string, null)<br> topic_arn = optional(string, null)<br> })))<br> }))</pre> | `{}` | no |
| <a name="input_queues"></a> [queues](#input\_queues) | Queues to be created | <pre>map(object({<br> alarm = optional(object({<br> create = optional(bool, false)<br> datapoints_to_alarm = optional(number, 3)<br> evaluation_periods = optional(number, 3)<br> backlog_minutes = optional(number, 3)<br> period = optional(number, 60)<br> threshold = optional(number, 0)<br> }))<br> queue = object({<br> dead_letter_queue_create = optional(bool, true)<br> delay_seconds = optional(number, null)<br> fifo_queue = optional(bool, false)<br> max_receive_count = optional(number, null)<br> message_retention_seconds = optional(number, null)<br> principals_with_send_permission = optional(list(string), null)<br> visibility_timeout_seconds = optional(number, null)<br> })<br> subscriptions = optional(map(object({<br> enabled = optional(bool, true)<br> filter_policy = optional(string, null)<br> topic_arn = optional(string, null)<br> })))<br> }))</pre> | `{}` | no |
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
Expand Down
8 changes: 5 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module "queue" {
source = "github.com/justtrackio/terraform-aws-sqs-queue?ref=v1.2.1"
source = "justtrackio/sqs-queue/aws"
version = "1.2.1"

for_each = var.queues

Expand All @@ -19,14 +20,15 @@ module "queue" {
fifo_queue = each.value.queue.fifo_queue
max_receive_count = each.value.queue.max_receive_count
message_retention_seconds = each.value.queue.message_retention_seconds
principals_with_send_permission = ["*"]
principals_with_send_permission = each.value.queue.principals_with_send_permission
queue_name = try(each.value.queue.fifo_queue, false) ? "${each.key}.fifo" : each.key
source_arns = [for k, v in each.value.subscriptions != null ? each.value.subscriptions : {} : v.topic_arn]
visibility_timeout_seconds = each.value.queue.visibility_timeout_seconds
}

module "dead" {
source = "github.com/justtrackio/terraform-aws-sqs-queue?ref=v1.2.0"
source = "justtrackio/sqs-queue/aws"
version = "1.2.1"

for_each = { for k, v in var.queues : k => v if v.queue.dead_letter_queue_create }

Expand Down
13 changes: 7 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ variable "queues" {
threshold = optional(number, 0)
}))
queue = object({
dead_letter_queue_create = optional(bool, true)
delay_seconds = optional(number, null)
fifo_queue = optional(bool, false)
max_receive_count = optional(number, null)
message_retention_seconds = optional(number, null)
visibility_timeout_seconds = optional(number, null)
dead_letter_queue_create = optional(bool, true)
delay_seconds = optional(number, null)
fifo_queue = optional(bool, false)
max_receive_count = optional(number, null)
message_retention_seconds = optional(number, null)
principals_with_send_permission = optional(list(string), null)
visibility_timeout_seconds = optional(number, null)
})
subscriptions = optional(map(object({
enabled = optional(bool, true)
Expand Down

0 comments on commit 9cb8c83

Please sign in to comment.