-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from kaleido-io/besu
Additional terraform example
- Loading branch information
Showing
4 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Summary | ||
|
||
Create an environment with: | ||
|
||
* Nodes and IPFS and Data Exchange Services | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|:----:|:-----:|:-----:| | ||
| kaleido_api_key | Kaleido API Key | string | - | yes | | ||
| kaleido_region | Can be '-ap' for Sydney, or '-eu' for Frankfurt. Defaults to US | string | `` | no | | ||
| provider | Blockchain Provider for the environment. | string | `pantheon` | no | | ||
| consensus | Consensus methods supported by pantheon. | list | `ibft` | no | | ||
| multi_region | Multi region env | string | `true` | no | | ||
| node_size | Size of the nodes to be created | string | `small` | no | | ||
| node_count | Number of nodes to create | string | 4 | no | | ||
| service_count | Number of services to create | string | 1 | no | |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
consortium_name = "test-consortium" | ||
kaleido_api_key = "" | ||
env_name = "test-environment" | ||
provider = "pantheon" | ||
consensus = "ibft" | ||
multi_region = "true" | ||
node_count = 1 | ||
block_period = 2 | ||
gc_mode = "archive" | ||
service_count = 4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
This creates suite of environments using all available | ||
environment types and consensus methods. | ||
*/ | ||
terraform { | ||
required_providers { | ||
kaleido = { | ||
source = "kaleido-io/kaleido" | ||
} | ||
} | ||
} | ||
|
||
provider "kaleido" { | ||
api = "https://console${var.kaleido_region}.kaleido.io/api/v1" | ||
api_key = "${var.kaleido_api_key}" | ||
} | ||
|
||
/* | ||
This represents a Consortia. Give it a name and a description. | ||
"mode" can be set to "single-org" or ... | ||
*/ | ||
resource "kaleido_consortium" "consortium" { | ||
name = "${var.consortium_name}" | ||
description = "${var.network_description}" | ||
} | ||
|
||
/* | ||
This creates a membership for each node | ||
*/ | ||
resource "kaleido_membership" "member" { | ||
count = "${var.node_count}" | ||
consortium_id = "${kaleido_consortium.consortium.id}" | ||
org_name = "Org ${count.index + 1}" | ||
} | ||
|
||
/* | ||
Create an environment | ||
*/ | ||
resource "kaleido_environment" "env" { | ||
consortium_id = "${kaleido_consortium.consortium.id}" | ||
multi_region = "${var.multi_region}" | ||
name = "${var.env_name}" | ||
env_type = "${var.provider_type}" | ||
consensus_type = "${var.consensus}" | ||
description = "${var.env_description}" | ||
} | ||
|
||
/* | ||
Create nodes | ||
*/ | ||
resource "kaleido_node" "kaleido" { | ||
count = "${var.node_count}" | ||
consortium_id = "${kaleido_consortium.consortium.id}" | ||
environment_id = "${kaleido_environment.env.id}" | ||
membership_id = "${element(kaleido_membership.member.*.id, count.index)}" | ||
name = "Node ${count.index + 1}" | ||
size = "${var.node_size}" | ||
} | ||
|
||
/* | ||
Create ipfs service | ||
*/ | ||
resource "kaleido_service" "kaleido" { | ||
count = "${var.service_count}" | ||
consortium_id = "${kaleido_consortium.consortium.id}" | ||
environment_id = "${kaleido_environment.env.id}" | ||
membership_id = "${element(kaleido_membership.member.*.id, count.index)}" | ||
name = "IPFS ${count.index + 1}" | ||
service_type = "ipfs" | ||
|
||
depends_on = ["kaleido_node.kaleido"] | ||
} | ||
|
||
/* | ||
Create DXE service - please contact Kaleido support if you're interested in using DataExchange Enterprise for FireFly multi-party networks | ||
https://hyperledger.github.io/firefly/v1.2.2/overview/multiparty/data_exchange.html | ||
*/ | ||
resource "kaleido_service" "dxe" { | ||
count = "${var.service_count}" | ||
consortium_id = "${kaleido_consortium.consortium.id}" | ||
environment_id = "${kaleido_environment.env.id}" | ||
membership_id = "${element(kaleido_membership.member.*.id, count.index)}" | ||
service_type = "dataexchange" | ||
name = "DXE ${count.index + 1}" | ||
size = "small" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
variable "kaleido_api_key" { | ||
type = string | ||
description = "Kaleido API Key" | ||
} | ||
|
||
variable "kaleido_region" { | ||
type = string | ||
description = "Can be '-ap' for Sydney, or '-eu' for Frankfurt. Defaults to US" | ||
default = "" | ||
} | ||
|
||
variable "provider_type" { | ||
type = string | ||
default = "pantheon" | ||
description = "Protocol implementation to deploy." | ||
} | ||
|
||
variable "consensus" { | ||
type = string | ||
default = "ibft" | ||
description = "Consensus mechanism." | ||
} | ||
|
||
variable "multi_region" { | ||
type = string | ||
default = true | ||
description = "Make the environment multi-region compatible to support additional regions, now or in the future" | ||
} | ||
|
||
variable "node_size" { | ||
type = string | ||
default = "small" | ||
description = "Size of the node" | ||
} | ||
|
||
variable "node_count" { | ||
type = string | ||
default = 4 | ||
description = "Count of nodes to create - each will have its own membership" | ||
} | ||
|
||
variable "service_count" { | ||
type = string | ||
default = 1 | ||
description = "Count of services to create - each will have its own membership" | ||
} | ||
|
||
variable "consortium_name" { | ||
type = string | ||
default = "My Business Network" | ||
} | ||
|
||
variable "env_name" { | ||
type = string | ||
default = "Development" | ||
} | ||
|
||
variable "env_description" { | ||
type = string | ||
default = "Created with Terraform" | ||
} | ||
variable "network_description" { | ||
type = string | ||
default = "Modern Business Network - Built on Kaleido" | ||
} |