Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ravendb/terraform-provider-ravendb
https://github.com/ravendb/terraform-provider-ravendb
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ravendb/terraform-provider-ravendb
- Owner: ravendb
- License: mit
- Created: 2021-09-22T13:59:56.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-26T07:19:41.000Z (3 months ago)
- Last Synced: 2024-07-11T18:14:50.779Z (2 months ago)
- Language: Go
- Size: 206 KB
- Stars: 6
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform provider for RavenDB
## Supported Platforms
- Linux
- Windows## Where to Ask for Help
If you have any questions, or need further assistance, you can [contact us directly](https://ravendb.net/contact).
## Requirements
| Name | Version |
|------|---------|
| terraform | > = 1.0.3 |## Providers
| Name | Version |
|---------|---------|
| ravendb | 1.0.2 |## Sample usage
### Providers
```hcl
terraform {
required_providers {
ravendb = {
source = "ravendb/ravendb"
version = ">=1.0.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
```### Local variables for RavenDB server resource
#### Example getting RavenDB server parameters from EC2 instances Terraform resources
```hcl
locals {
# Node tags
nodes = toset(["a", "b", "c"])
# Ec2 hosts
hosts = flatten([
for instance in module.ec2_instances : [
instance.public_ip
]
])
# This sample represents the nodes that will be used for unsecured setup.
ravendb_nodes_urls = flatten([
for instance in module.ec2_instances: [
"http://${instance.public_ip}:8080"
]
])
# This samples represents the nodes that will be used for secure setup.
ravendb_nodes_urls = [for tag in local.nodes : "https://${tag}.omermichleviz.development.run"]
# This smaples shows the usage of map reduce parameters to a given index.
maps = [
< x.Country).aggregate(g => {
return {
Country: g.key,
Count: g.values.reduce((count, val) => val.Count + count, 0)
}
})
EOT
}
```#### RavenDB server Terraform resource parameters
```hcl
locals {
# IP addresses for hosts to deploy RavenDB to
hosts = [
"3.95.238.149",
"3.87.248.150",
"3.95.220.189"
]
# This sample represents the nodes that will be used for unsecured setup.
ravendb_nodes_urls = [
"http://3.95.238.149:8080",
"http://3.87.248.150:8080",
"http://3.95.220.189:8080"
]
# This samples represents the nodes that will be used for secure setup.
ravendb_nodes_urls = [
"https://a.domain.development.run",
"https://b.domain.development.run",
"https://c.domain.development.run"
]
}
```### RavenDB server resource
```hcl
resource "ravendb_server" "server" {
hosts = local.hosts
database = "firewire"
unsecured = true
cluster_setup_zip = "/path/to/cluster/setup.zip"
package {
version = "5.4.111"
}
url {
list = local.ravendb_nodes_urls
http_port = 8080
tcp_port = 38880
}
license = filebase64("/path/to/license.json")
settings_override = {
"Indexing.MapBatchSize" = 16384
}
assets = {
"/path/to/file/file_name.extension" = filebase64("/path/to/file_name.extension")
}
ssh {
user = "ubuntu"
pem = filebase64("/path/to/server.pem")
}
databases_to_delete {
database {
name = "database_name"
hard_delete = false
}
}indexes_to_delete {
index {
database_name = "database_name"
indexes_names = [
"index_name",
"index_name",
]
}
}
databases {
database {
name = "database_name"
replication_nodes = local.nodes
encryption_key = "base64_encryption_key"
settings = {
"Subscriptions.MaxNumberOfConcurrentConnections" = 2000
}indexes {
index {
index_name = "index_name"
maps = local.map
reduce = local.reduce
configuration = {
"Indexing.MapBatchSize" = 128
}
}
}
}
}
}```
### Output
```hcl
output "public_instance_ips" {
value = local.list
}
output "database_name" {
value = ravendb_server.server.database
}
```## Inputs
| Name| Description| Type| Required |
|-|-|-|-|
| hosts | The ip addresses of the nodes that terraform will use to setup the RavenDB cluster. | `list` | yes |
| database - `optional` | The database name to check whether he is alive or not. It will create the given database if it doesn't exists | `string` | no |
| cluster_setup_zip - `optional` | The cluster setup zip file that is used by RavenDB for setup secured cluster. | `string` | no |
| license | The license file that will be used for the setup of the RavenDB cluster. | `filebase64` | yes |
| package
- version
- arch - `optional`
- UbuntuVersion - `optional`
- `string`
- `string`
- `string`
| unsecured | Whatever to allow to run RavenDB in unsecured mode. This is ***NOT*** recommended! | `bool` | no | |
| settings_override | Overriding the settings.json. | `map[string][string]` | no |
| assets | Upload files to an absolute path. | `map[string][string]` | no |
| url
- list
- http_url - `optional`
- tcp_url - `optional`
- `List(string)`
- `int`
- `int` | yes |
- database
- name
- replication_nodes
- encryption_key
- settings
- indexes
- index
- index_name
- maps
- reduce
- configuration
- `set`
- `string`
- `list(string)`
- `string`
- `map(string)`
- `set`
- `set`
- `string`
- `list(string)`
- `string`
- `map(string)`
| databases - `optional`
| databases_to_delete - `optional`
- database
- name
- hard_delete | Databases that will be hard/soft deleted. | `set`
- `set`
- `string`
- `bool`
| indexes_to_delete - `optional`
- index
- name
- indexes_names | Indexes that will be deleted on a given database. | `set`
- `set`
- `string`
- `list(string)`
## Debug mode
In order to be able to see debug log you need to define `environment variables`.
For `powershell`
```shell
$env:TF_LOG="DEBUG"
$env:TF_LOG_PATH='d:/debug_log.txt'
```
For `bash`
```shell
export TF_LOG=DEBUG
export TF_LOG_PATH=d:/debug_log.txt
```
### Environment variables information
https://www.terraform.io/docs/cli/config/environment-variables.html
## Environment variables for running acceptances tests
`powershell`
```shell
$env:TF_ACC=1
```
```bash
export TF_ACC=1
```