-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathredis.tf
More file actions
35 lines (30 loc) · 944 Bytes
/
redis.tf
File metadata and controls
35 lines (30 loc) · 944 Bytes
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
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
resource "null_resource" "docker_compose_up" {
triggers = {
always_run = "${timestamp()}"
}
// Running down at the beginning so terraform apply can be executed multiple times to pick up on latest docker-compose.yaml changes
provisioner "local-exec" {
command = "docker compose -f ./docker-compose.yml down && docker compose -f ./docker-compose.yml up -d"
when = create
}
}
resource "null_resource" "docker_compose_down" {
triggers = {
always_run = "${timestamp()}"
}
provisioner "local-exec" {
command = "docker compose -f ./docker-compose.yml down"
when = destroy
}
}
resource "local_file" "setup_environment_file" {
filename = "local_environment_setup.sh"
content = <<EOF
export TEST_REDIS_HOST=localhost
export TEST_REDIS_PORT=6379
export TEST_REDIS_USERNAME=default
export TEST_REDIS_PASSWORD=default-pa55w0rd
EOF
}