Created
February 22, 2019 19:37
-
-
Save srfrog/6dc9e8a1aaf525a6916842da4277f634 to your computer and use it in GitHub Desktop.
Dgraph deploy configuration (v0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
tls_dev = false | |
} | |
# Dgraph zero config for development | |
resource "dgraph_node" "zero_dev" { | |
use_tls = ${local.tls_dev} | |
} | |
# Dgraph alpha config for development | |
resource "dgraph_node" "alpha_dev" { | |
depends_on = ["dgraph_node.zero_dev"] | |
lru_mb = "1024" | |
use_tls = ${local.tls_dev} | |
} | |
# Cluster defines a config of zeroes and alphas | |
resource "dgraph_cluster" "dev" { | |
name = "dev cluster" | |
zero { | |
num = "1" | |
node = ${dgraph_node.zero_dev} | |
} | |
# one group | |
alpha { | |
num = "3" | |
node = ${dgraph_node.alpha_dev} | |
} | |
# another group, etc... | |
#alpha { | |
# num = "3" | |
# node = ${dgraph_node.alpha_dev} | |
#} | |
} | |
# Dgraph Docker deployment | |
resource "dgraph_deploy" "docker" { | |
depends_on = ["dgraph_cluster.dev"] | |
} | |
# Dgraph AWS deployment | |
resource "dgraph_deploy" "aws" { | |
depends_on = ["dgraph_cluster.prod"] | |
} | |
### Providers | |
# Configure the Docker provider | |
provider "docker" { | |
host = "tcp://127.0.0.1:2376/" | |
} | |
resource "docker_image" "dgraph" { | |
name = "dgraph:latest" | |
} | |
# Create a container | |
resource "docker_container" "dgraph" { | |
image = "${docker_image.dgraph.latest}" | |
name = "foo" | |
} | |
# Configure the AWS Provider | |
provider "aws" { | |
access_key = "${var.aws_access_key}" | |
secret_key = "${var.aws_secret_key}" | |
region = "us-west-2" | |
} | |
resource "aws_vpc" "foo" { | |
cidr_block = "198.18.0.0/16" | |
} | |
# Create a web server | |
resource "aws_instance" "dgraph" { | |
# ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment