Skip to content

Commit

Permalink
Merge pull request #63 from kaleido-io/v1.1-baas
Browse files Browse the repository at this point in the history
Updates from addition regression testing on BaaS resources
  • Loading branch information
peterbroadhurst committed Apr 21, 2024
2 parents fce2b7b + 5c6ffcf commit 953a499
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 350 deletions.
2 changes: 1 addition & 1 deletion examples/multi_region_with_b2b/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.terraform*
terraform.d
terraform.tfvars
terraform.tfstate*
terraform
1 change: 0 additions & 1 deletion examples/multi_region_with_b2b/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ resource "kaleido_membership" "member" {
count = var.member_count
consortium_id = kaleido_consortium.consortium.id
org_name = "Org ${count.index + 1}"
shared_deployment = true
}

/*
Expand Down
1 change: 1 addition & 0 deletions examples/simple_env/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.terraform*
terraform.d
terraform.tfvars
terraform.tfstate*
51 changes: 30 additions & 21 deletions examples/simple_env/main.tf
Original file line number Diff line number Diff line change
@@ -1,63 +1,72 @@
terraform {
required_providers {
kaleido = {
source = "kaleido-io/kaleido"
version = "1.1.0-rc.2"
}
}
}

/*
This creates suite of environments using all available
environment types and consensus methods.
*/

provider "kaleido" {
api = "https://console${var.kaleido_region}.kaleido.io/api/v1"
api_key = "${var.kaleido_api_key}"
api = var.kaleido_api_url
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}"
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}"
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}"
consensus_type = "${var.consensus}"
description = "${var.env_description}"
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)}"
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}"
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)}"
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"

Expand Down
38 changes: 19 additions & 19 deletions examples/simple_env/variables.tf
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
variable "kaleido_api_key" {
type = "string"
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 "kaleido_api_url" {
type = string
description = "Regional API URL for the Kaleido platform"
default = "https://console.kaleido.io/api/v1"
}

variable "provider" {
type = "string"
variable "provider_type" {
type = string
default = "quorum"
description = "Protocol implementation to deploy."
}

variable "consensus" {
type = "string"
type = string
default = "ibft"
description = "Consensus mechanism."
}

variable "multi_region" {
type = "string"
type = bool
default = false
description = "Make the environment multi-region compatible to support additional regions, now or in the future"
}

variable "node_size" {
type = "string"
type = string
default = "small"
description = "Size of the node"
}

variable "node_count" {
type = "string"
type = string
default = 4
description = "Count of nodes to create - each will have its own membership"
}

variable "service_count" {
type = "string"
variable service_count {
type = string
default = 1
description = "Count of services to create - each will have its own membership"
}

variable "consortium_name" {
type = "string"
variable consortium_name {
type = string
default = "My Business Network"
}

variable "env_name" {
type = "string"
variable env_name {
type = string
default = "Development"
}

variable "env_description" {
type = "string"
type = string
default = "Created with Terraform"
}
variable "network_description" {
type = "string"
type = string
default = "Modern Business Network - Built on Kaleido"
}
40 changes: 30 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,44 @@ toolchain go1.21.6

require (
github.com/aidarkhanov/nanoid v1.0.8
github.com/go-resty/resty/v2 v2.11.0
github.com/go-resty/resty/v2 v2.12.0
github.com/gorilla/mux v1.8.1
github.com/hashicorp/terraform-plugin-framework v1.6.0
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
github.com/hashicorp/terraform-plugin-go v0.22.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.6.0
github.com/kaleido-io/kaleido-sdk-go v0.0.0-20220527154448-e74b3fbc26c9
github.com/kaleido-io/kaleido-sdk-go v0.0.0-20240421154223-e277257d6a5f
github.com/stretchr/testify v1.9.0
gopkg.in/h2non/gock.v1 v1.0.15
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum/go-ethereum v1.10.25 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
Expand All @@ -49,41 +58,52 @@ require (
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/magiconair/properties v1.8.4 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rjeczalik/notify v0.9.2 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.1.3 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.7.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/resty.v1 v1.12.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 953a499

Please sign in to comment.