|
@@ -0,0 +1,44 @@
|
|
|
|
+resource "docker_image" "postgres" {
|
|
|
|
+ name = "postgres:9.6"
|
|
|
|
+ keep_locally = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+resource "docker_image" "keycloak" {
|
|
|
|
+ name = "jboss/keycloak-postgres"
|
|
|
|
+ keep_locally = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+resource "docker_container" "postgres" {
|
|
|
|
+ name = "postgres"
|
|
|
|
+ image = "${docker_image.postgres.latest}"
|
|
|
|
+
|
|
|
|
+ env = [
|
|
|
|
+ "POSTGRES_PASSWORD=winning",
|
|
|
|
+ "PGDATA=/postgres_data",
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ volumes {
|
|
|
|
+ container_path = "/postgres_data"
|
|
|
|
+ host_path = "${path.module}/postgres_data"
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+resource "docker_container" "keycloak" {
|
|
|
|
+ name = "keycloak"
|
|
|
|
+ image = "${docker_image.keycloak.latest}"
|
|
|
|
+
|
|
|
|
+ ports {
|
|
|
|
+ internal = 8080
|
|
|
|
+ external = 8080
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ links = [
|
|
|
|
+ "${docker_container.postgres.name}",
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ env = [
|
|
|
|
+ "POSTGRES_DATABASE=local",
|
|
|
|
+ "POSTGRES_PORT_5432_TCP_ADDR=${docker_container.postgres.name}",
|
|
|
|
+ "KEYCLOAK_USER=local",
|
|
|
|
+ ]
|
|
|
|
+}
|