-
Notifications
You must be signed in to change notification settings - Fork 1
/
redis.tf
65 lines (53 loc) · 2.31 KB
/
redis.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
resource "azurerm_redis_cache" "celery_broker" {
name = "${var.stack_name}-celery-broker"
location = var.location
resource_group_name = var.resource_group_name
capacity = 1
family = "C"
sku_name = "Basic"
# subnet_id = var.redis_subnet_id
public_network_access_enabled = true
redis_configuration {
}
tags = {
Terraform = "true"
Environment = "dev"
}
}
resource "azurerm_private_endpoint" "celery_broker" {
name = "${var.stack_name}-celery-broker-endpoint"
location = var.location
resource_group_name = var.resource_group_name
subnet_id = var.redis_subnet_id
private_service_connection {
name = "${var.stack_name}-celery-broker-psc"
private_connection_resource_id = azurerm_redis_cache.celery_broker.id
subresource_names = [ "redisCache" ]
is_manual_connection = false
}
}
# TODO: It's not currently possible to determine the IP address that container instances
# are making requests from. Thus we must disable the redis cache firewall... :(
resource "azurerm_redis_firewall_rule" "disable" {
name = "${var.stack_name}"
redis_cache_name = azurerm_redis_cache.celery_broker.name
resource_group_name = var.resource_group_name
start_ip = "0.0.0.0"
end_ip = "255.255.255.255"
}
# resource "azurerm_redis_firewall_rule" "script_runner" {
# count = var.server_count
# name = replace("${var.stack_name}-script-runner-fw", "-", "_")
# redis_cache_name = azurerm_redis_cache.celery_broker.name
# resource_group_name = var.resource_group_name
# start_ip = azurerm_container_group.script_runner[count.index].ip_address
# end_ip = azurerm_container_group.script_runner[count.index].ip_address
# }
# resource "azurerm_redis_firewall_rule" "script_worker" {
# count = var.worker_count
# name = replace("${var.stack_name}-script-worker-fw", "-", "_")
# redis_cache_name = azurerm_redis_cache.celery_broker.name
# resource_group_name = var.resource_group_name
# start_ip = azurerm_container_group.script_worker[count.index].ip_address
# end_ip = azurerm_container_group.script_worker[count.index].ip_address
# }