-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
114 lines (94 loc) · 2.87 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
terraform {
required_version = "~> 1.5"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.71"
}
random = {
source = "hashicorp/random"
version = "~> 3.6"
}
}
}
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
data "azurerm_client_config" "current" {}
locals {
prefix = "queues"
skus = ["Basic", "Standard", "Premium"]
}
module "regions" {
source = "Azure/regions/azurerm"
version = ">= 0.3.0"
recommended_regions_only = true
}
resource "random_integer" "region_index" {
max = length(module.regions.regions) - 1
min = 0
}
module "naming" {
source = "Azure/naming/azurerm"
version = ">= 0.3.0"
}
resource "azurerm_resource_group" "example" {
location = module.regions.regions[random_integer.region_index.result].name
name = "${module.naming.resource_group.name_unique}-${local.prefix}"
}
module "servicebus" {
source = "../../"
for_each = toset(local.skus)
sku = each.value
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
name = "${module.naming.servicebus_namespace.name_unique}-${each.value}-${local.prefix}"
queues = {
forwardQueue = {
}
fromForwardQueue = {
requires_session = false
forward_to = "forwardQueue"
forward_dead_lettered_messages_to = "forwardQueue"
}
enableExpressQueue = {
enable_express = true
requires_duplicate_detection = false
}
testQueue = {
auto_delete_on_idle = "P7D"
dead_lettering_on_message_expiration = true
default_message_ttl = "PT5M"
duplicate_detection_history_time_window = "PT5M"
enable_batched_operations = true
enable_express = false
enable_partitioning = true
lock_duration = "PT1M"
requires_duplicate_detection = true
requires_session = true
max_delivery_count = 100
max_message_size_in_kilobytes = 1024
max_size_in_megabytes = 1024
status = "Active"
role_assignments = {
key = {
skip_service_principal_aad_check = false
role_definition_id_or_name = "Contributor"
description = "This is a test role assignment"
principal_id = data.azurerm_client_config.current.object_id
}
}
authorization_rules = {
testRule = {
send = true
listen = true
manage = true
}
}
}
}
}