Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b6a7564
feat: added fscloud profile
Ak-sky May 11, 2023
8b29f34
feat: fixed pr_test
Ak-sky May 11, 2023
3c642cd
feat: fixed pr_test
Ak-sky May 12, 2023
bf390d5
feat: fixed ci env vars
Ak-sky May 12, 2023
90bc1a4
feat: added kms_encryption_enabled variable and cra ignore
Ak-sky May 15, 2023
9c4484f
feat: fscloud profile fixes
Ak-sky May 15, 2023
03eabd4
Merge branch 'main' into es-fscloud
Ak-sky May 22, 2023
ab1cf2e
feat: fscloud profile fixes
Ak-sky May 22, 2023
9014cf7
Merge branch 'main' into es-fscloud
Ak-sky May 29, 2023
decb6dd
feat: fscloud profile fixes
Ak-sky May 29, 2023
d54c1a3
feat: fscloud profile fixes
Ak-sky May 29, 2023
e07df40
feat: fscloud profile fixes
Ak-sky May 31, 2023
7ef88a3
Merge branch 'es-fscloud' of github.com:terraform-ibm-modules/terrafo…
Ak-sky May 31, 2023
1e9433e
refactor: added standard plan for basic ex.
Ak-sky Jun 1, 2023
465a5a1
refactor: removed rule form ignore file (CRA v1.36)
Ak-sky Jun 1, 2023
a277093
Revert "refactor: removed rule form ignore file (CRA v1.36)"
Ak-sky Jun 1, 2023
c742a09
refactor: addressed the review comments
Ak-sky Jun 2, 2023
b70d544
Merge branch 'main' into es-fscloud
Ak-sky Jun 2, 2023
bf87ba2
Merge branch 'es-fscloud' of github.com:terraform-ibm-modules/terrafo…
Ak-sky Jun 2, 2023
200ec56
refactor: addressed the review comments
Ak-sky Jun 2, 2023
1bda608
refactor: addressed the review comments
Ak-sky Jun 3, 2023
069d940
refactor: addressed the review comments
Ak-sky Jun 3, 2023
1e91667
doc: addressed review comments
Ak-sky Jun 7, 2023
091dfec
doc: addressed review comments
Ak-sky Jun 7, 2023
1acf14d
refactor: removed cbr from complete ex and skipping upgrade test
Ak-sky Jun 9, 2023
a7509ef
refactor: added the complete ex back in pr test
Ak-sky Jun 9, 2023
4b09014
refactor: modified readme
Ak-sky Jun 9, 2023
8cad5fa
refactor: modified complete ex and SKIP UPGRADE TEST due to CBR in ma…
Ak-sky Jun 9, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: added fscloud profile
  • Loading branch information
Ak-sky committed May 11, 2023
commit b6a75646a05e3c459197b563c20245b15fc949b9
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
secrets: inherit
with:
craSCCv2: true
craTarget: "examples/complete"
craTarget: "examples/fscloud"
craRuleIgnoreFile: "cra-tf-validate-ignore-rules.json"
craEnvironmentVariables: "TF_VAR_existing_at_instance_crn=${{ vars.AT_INSTANCE_CRN }}"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ You need the following permissions to run this module.

- [ Basic example](examples/basic)
- [ Complete example with BYOK encryption](examples/complete)
- [ Complete example with BYOK encryption](examples/fscloud)
<!-- END EXAMPLES HOOK -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
Expand Down
7 changes: 7 additions & 0 deletions examples/fscloud/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Complete example with BYOK encryption

An end-to-end example that creates an event streams instance with key protect.
This example uses the IBM Cloud terraform provider to:
- Create a new resource group if one is not passed in.
- Create a Key Protect instance and root key in the provided region.
- Create a new event streams instance in the resource group and region provided, encrypted with the root key created above, and configured with topics and schemas.
26 changes: 26 additions & 0 deletions examples/fscloud/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
##############################################################################
# Resource Group
##############################################################################

module "resource_group" {
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-resource-group.git?ref=v1.0.5"
# if an existing resource group is not set (null) create a new one using prefix
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
existing_resource_group_name = var.resource_group
}

# #############################################################################
# Events-streams-instance
# #############################################################################

module "event_streams" {
source = "../../profiles/fscloud"
resource_group_id = module.resource_group.resource_group_id
es_name = "${var.prefix}-es"
plan = var.plan
kms_key_crn = var.kms_key_crn
existing_kms_instance_guid = var.existing_kms_instance_guid
schemas = var.schemas
tags = var.resource_tags
topics = var.topics
}
33 changes: 33 additions & 0 deletions examples/fscloud/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
##############################################################################
# Outputs
##############################################################################

output "resource_group_name" {
description = "Resource group name"
value = module.resource_group.resource_group_name
}

output "resource_group_id" {
description = "Resource group ID"
value = module.resource_group.resource_group_id
}

output "crn" {
description = "Event Streams instance crn"
value = module.event_streams.crn
}

output "guid" {
description = "Event Streams instance guid"
value = module.event_streams.guid
}

output "kafka_brokers_sasl" {
description = "(Array of Strings) Kafka brokers use for interacting with Kafka native API"
value = module.event_streams.kafka_brokers_sasl
}

output "kafka_http_url" {
description = "The API endpoint to interact with Event Streams REST API"
value = module.event_streams.kafka_http_url
}
4 changes: 4 additions & 0 deletions examples/fscloud/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
}
113 changes: 113 additions & 0 deletions examples/fscloud/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
variable "ibmcloud_api_key" {
type = string
description = "The IBM Cloud API Key"
sensitive = true
}

variable "region" {
type = string
description = "Region to provision all resources created by this example"
default = "us-south"
}

variable "plan" {
type = string
description = "Plan for the event stream instance. lite, standard or enterprise-3nodes-2tb"
default = "standard"
}

variable "prefix" {
type = string
description = "Prefix to append to all resources created by this example"
default = "fs-cloud"
}

variable "resource_group" {
type = string
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
default = null
}

variable "resource_tags" {
type = list(string)
description = "List of tags associated with the Event Steams instance"
default = []
}

variable "schemas" {
type = list(object(
{
schema_id = string
schema = object({
type = string
name = string
})
}
))
description = "The list of schema object which contains schema id and format of the schema"
default = [{
schema_id = "my-es-schema_1"
schema = {
type = "string"
name = "name_1"
}
},
{
schema_id = "my-es-schema_2"
schema = {
type = "string"
name = "name_2"
}
},
{
schema_id = "my-es-schema_3"
schema = {
type = "string"
name = "name_3"
}
}
]
}

variable "topics" {
type = list(object(
{
name = string
partitions = number
config = object({})
}
))
description = "List of topics. For lite plan only one topic is allowed."
default = [
{
name = "topic-1"
partitions = 1
config = {
"cleanup.policy" = "delete"
"retention.ms" = "86400000"
"retention.bytes" = "10485760"
"segment.bytes" = "10485760"
}
},
{
name = "topic-2"
partitions = 1
config = {
"cleanup.policy" = "compact,delete"
"retention.ms" = "86400000"
"retention.bytes" = "1073741824"
"segment.bytes" = "536870912"
}
}
]
}

variable "existing_kms_instance_guid" {
description = "The GUID of the Hyper Protect Crypto service in which the key specified in var.kms_key_crn is coming from"
type = string
}

variable "kms_key_crn" {
type = string
description = "The root key CRN of a Hyper Protect Crypto Service (HPCS) that you want to use for disk encryption. See https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs&interface=ui for more information on integrating HPCS with MongoDB instance."
}
9 changes: 9 additions & 0 deletions examples/fscloud/version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.3.0"
required_providers {
ibm = {
source = "IBM-Cloud/ibm"
version = "1.49.0"
}
}
}
7 changes: 7 additions & 0 deletions profiles/fscloud/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Complete example with BYOK encryption

An end-to-end example that creates an event streams instance with key protect.
This example uses the IBM Cloud terraform provider to:
- Create a new resource group if one is not passed in.
- Create a Key Protect instance and root key in the provided region.
- Create a new event streams instance in the resource group and region provided, encrypted with the root key created above, and configured with topics and schemas.
13 changes: 13 additions & 0 deletions profiles/fscloud/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module "event_streams" {
source = "../../"
resource_group_id = var.resource_group_id
es_name = var.es_name
plan = var.plan
skip_iam_authorization_policy = var.skip_iam_authorization_policy
kms_key_crn = var.kms_key_crn
existing_kms_instance_guid = var.existing_kms_instance_guid
schemas = var.schemas
tags = var.tags
topics = var.topics
service_endpoints = "private"
}
23 changes: 23 additions & 0 deletions profiles/fscloud/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
##############################################################################
# Outputs
##############################################################################

output "crn" {
description = "Event Streams instance crn"
value = module.event_streams.crn
}

output "guid" {
description = "Event Streams instance guid"
value = module.event_streams.guid
}

output "kafka_brokers_sasl" {
description = "(Array of Strings) Kafka brokers use for interacting with Kafka native API"
value = module.event_streams.kafka_brokers_sasl
}

output "kafka_http_url" {
description = "The API endpoint to interact with Event Streams REST API"
value = module.event_streams.kafka_http_url
}
107 changes: 107 additions & 0 deletions profiles/fscloud/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
variable "plan" {
type = string
description = "Plan for the event stream instance. lite, standard or enterprise-3nodes-2tb"
default = "standard"
}

variable "resource_group_id" {
description = "ID of resource group to use when creating the event stream instance"
type = string
}

variable "tags" {
type = list(string)
description = "List of tags associated with the Event Steams instance"
default = []
}

variable "es_name" {
description = "Name of the event streams instance"
type = string
}

variable "schemas" {
type = list(object(
{
schema_id = string
schema = object({
type = string
name = string
})
}
))
description = "The list of schema object which contains schema id and format of the schema"
default = [{
schema_id = "my-es-schema_1"
schema = {
type = "string"
name = "name_1"
}
},
{
schema_id = "my-es-schema_2"
schema = {
type = "string"
name = "name_2"
}
},
{
schema_id = "my-es-schema_3"
schema = {
type = "string"
name = "name_3"
}
}
]
}

variable "topics" {
type = list(object(
{
name = string
partitions = number
config = object({})
}
))
description = "List of topics. For lite plan only one topic is allowed."
default = [
{
name = "topic-1"
partitions = 1
config = {
"cleanup.policy" = "delete"
"retention.ms" = "86400000"
"retention.bytes" = "10485760"
"segment.bytes" = "10485760"
}
},
{
name = "topic-2"
partitions = 1
config = {
"cleanup.policy" = "compact,delete"
"retention.ms" = "86400000"
"retention.bytes" = "1073741824"
"segment.bytes" = "536870912"
}
}
]
}

variable "kms_key_crn" {
type = string
description = "(Optional) The root key CRN of a Key Management Service like Key Protect or Hyper Protect Crypto Service (HPCS) that you want to use for disk encryption. If null, database is encrypted by using randomly generated keys. See https://cloud.ibm.com/docs/EventStreams?topic=EventStreams-managing_encryption for more info."
default = null
}

variable "existing_kms_instance_guid" {
description = "(Optional) The GUID of the Hyper Protect or Key Protect instance in which the key specified in var.kms_key_crn is coming from. Only required if skip_iam_authorization_policy is false"
type = string
default = null
}

variable "skip_iam_authorization_policy" {
type = bool
description = "Set to true to skip the creation of an IAM authorization policy that permits all mongodb instances in the provided resource group reader access to the instance specified in the existing_kms_instance_guid variable."
default = false
}
3 changes: 3 additions & 0 deletions profiles/fscloud/version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terraform {
required_version = ">= 1.3.0"
}
Loading