Skip to content

Instantly share code, notes, and snippets.

@jyee
Created March 18, 2021 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyee/492b1da663e91844d1a6563e99c0f21f to your computer and use it in GitHub Desktop.
Save jyee/492b1da663e91844d1a6563e99c0f21f to your computer and use it in GitHub Desktop.
Using Terraform to Install Gremlin
variable "gremlin_team_id" {
type = string
description = "The Gremlin team ID. See https://app.gremlin.com/settings/teams to get your team ID."
}
variable "gremlin_team_secret" {
type = string
description = "The Gremlin team secret. See https://app.gremlin.com/settings/teams to get your team secret."
}
# To install Gremlin on Kubernetes, use the Helm provider. Then apply the Gremlin Helm Chart.
provider "helm" {
kubernetes {
load_config_file = "false"
# Use Terraform to setup your Kubernetes cluster and pass the cluster information below.
host = your_kubernetes_cluster.k8s_cluster.endpoint
token = your_kubernetes_cluster.k8s_cluster.kube_config[0].token
cluster_ca_certificate = base64decode(your_kubernetes_cluster.k8s_cluster.kube_config[0].cluster_ca_certificate)
}
}
# Apply Gremlin Helm chart
resource "helm_release" "gremlin_helm_chart" {
name = "gremlin"
chart = "gremlin/gremlin"
set {
name = "gremlin.secret.managed"
value = "true"
}
set {
name = "gremlin.secret.type"
value = "secret"
}
set {
name = "gremlin.secret.clusterID"
# This value can be passed from your Kubernetes cluster or set to an arbitrary string.
value = your_kubernetes_cluster.id
}
set {
name = "gremlin.secret.teamID"
value = var.gremlin_team_id
}
set {
name = "gremlin.secret.teamSecret"
value = var.gremlin_team_secret
}
# To install Gremlin on a VM or bare-metal server, you'll likely want to use the remote-exec provisioner.
# This allows you to run commands on the server. Pass the commands found in the Gremlin installation
# documentation at https://www.gremlin.com/docs/infrastructure-layer/installation/
resource "aws_instance" "web" {
provisioner "remote-exec" {
inline = [
"sudo yum install -y iproute-tc",
"sudo curl https://rpm.gremlin.com/gremlin.repo -o /etc/yum.repos.d/gremlin.repo",
"sudo yum install -y gremlin gremlind",
"export GREMLIN_TEAM_ID=var.gremlin_team_id",
"export GREMLIN_TEAM_SECRET=var.gremlin_team_secret",
"gremlin init"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment