65 lines
1.2 KiB
Markdown
65 lines
1.2 KiB
Markdown
|
<h1> Deploying a ZDB with terraform </h1>
|
||
|
|
||
|
<h2>Table of Contents</h2>
|
||
|
|
||
|
- [Introduction](#introduction)
|
||
|
- [Example](#example)
|
||
|
|
||
|
***
|
||
|
|
||
|
## Introduction
|
||
|
|
||
|
We provide a basic template for ZDB deployment with Terraform on the TFGrid.
|
||
|
|
||
|
A brief description of zdb fields can be found [here](https://github.com/threefoldtech/terraform-provider-grid/blob/development/docs/resources/deployment.md#nested-schema-for-zdbs).
|
||
|
|
||
|
A more thorough description of zdb operation can be found in its parent [repo](https://github.com/threefoldtech/0-db).
|
||
|
|
||
|
## Example
|
||
|
|
||
|
```
|
||
|
terraform {
|
||
|
required_providers {
|
||
|
grid = {
|
||
|
source = "threefoldtech/grid"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
provider "grid" {
|
||
|
}
|
||
|
|
||
|
resource "grid_deployment" "d1" {
|
||
|
node = 4
|
||
|
|
||
|
zdbs{
|
||
|
name = "zdb1"
|
||
|
size = 10
|
||
|
description = "zdb1 description"
|
||
|
password = "zdbpasswd1"
|
||
|
mode = "user"
|
||
|
}
|
||
|
zdbs{
|
||
|
name = "zdb2"
|
||
|
size = 2
|
||
|
description = "zdb2 description"
|
||
|
password = "zdbpasswd2"
|
||
|
mode = "seq"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
output "deployment_id" {
|
||
|
value = grid_deployment.d1.id
|
||
|
}
|
||
|
|
||
|
output "zdb1_endpoint" {
|
||
|
value = format("[%s]:%d", grid_deployment.d1.zdbs[0].ips[0], grid_deployment.d1.zdbs[0].port)
|
||
|
}
|
||
|
|
||
|
output "zdb1_namespace" {
|
||
|
value = grid_deployment.d1.zdbs[0].namespace
|
||
|
}
|
||
|
```
|
||
|
|
||
|
|