generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into issue-10936
- Loading branch information
Showing
14 changed files
with
321 additions
and
21 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
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,17 @@ | ||
# Financial Services Cloud profile example | ||
|
||
An end-to-end example that uses the [Profile for IBM Cloud Framework for Financial Services](https://github.com/terraform-ibm-modules/terraform-ibm-event-streams/tree/main/modules/fscloud) to deploy an instance of Event Streams. | ||
|
||
The example uses the IBM Cloud Terraform provider to create the following infrastructure: | ||
|
||
- A resource group, if one is not passed in. | ||
- An IAM authorization between all Event Stream instances in the given resource group and the Hyper Protect Crypto Services instance that is passed in. | ||
- An Event Streams instance that is encrypted with the Hyper Protect Crypto Services root key that is passed in. | ||
- A sample virtual private cloud (VPC). | ||
- A context-based restriction (CBR) rule to only allow Event Streams to be accessible from within the VPC. | ||
|
||
:exclamation: **Important:** In this example, only the Event Streams instance complies with the IBM Cloud Framework for Financial Services. Other parts of the infrastructure do not necessarily comply. | ||
|
||
## Before you begin | ||
|
||
- You need a Hyper Protect Crypto Services instance and root key available in the region that you want to deploy your Event Streams instance to. |
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,83 @@ | ||
############################################################################## | ||
# Resource Group | ||
############################################################################## | ||
|
||
module "resource_group" { | ||
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-resource-group.git?ref=v1.1.6" | ||
# 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 | ||
} | ||
|
||
############################################################################## | ||
# Get Cloud Account ID | ||
############################################################################## | ||
|
||
data "ibm_iam_account_settings" "iam_account_settings" { | ||
} | ||
|
||
############################################################################## | ||
# VPC | ||
############################################################################## | ||
resource "ibm_is_vpc" "example_vpc" { | ||
name = "${var.prefix}-vpc" | ||
resource_group = module.resource_group.resource_group_id | ||
tags = var.resource_tags | ||
} | ||
|
||
resource "ibm_is_subnet" "testacc_subnet" { | ||
name = "${var.prefix}-subnet" | ||
vpc = ibm_is_vpc.example_vpc.id | ||
zone = "${var.region}-1" | ||
total_ipv4_address_count = 256 | ||
resource_group = module.resource_group.resource_group_id | ||
} | ||
|
||
############################################################################## | ||
# Create CBR Zone | ||
############################################################################## | ||
module "cbr_zone" { | ||
source = "terraform-ibm-modules/cbr/ibm//modules/cbr-zone-module" | ||
version = "1.27.0" | ||
name = "${var.prefix}-VPC-network-zone" | ||
zone_description = "CBR Network zone representing VPC" | ||
account_id = data.ibm_iam_account_settings.iam_account_settings.account_id | ||
addresses = [{ | ||
type = "vpc", # to bind a specific vpc to the zone | ||
value = ibm_is_vpc.example_vpc.crn, | ||
}] | ||
} | ||
|
||
|
||
# ############################################################################# | ||
# Events-streams-instance | ||
# ############################################################################# | ||
|
||
module "event_streams" { | ||
source = "../../modules/fscloud" | ||
resource_group_id = module.resource_group.resource_group_id | ||
es_name = "${var.prefix}-es-fs" | ||
kms_key_crn = var.kms_key_crn | ||
schemas = var.schemas | ||
tags = var.resource_tags | ||
topics = var.topics | ||
existing_kms_instance_guid = var.existing_kms_instance_guid | ||
cbr_rules = [ | ||
{ | ||
description = "${var.prefix}-event stream access only from vpc" | ||
enforcement_mode = "enabled" | ||
account_id = data.ibm_iam_account_settings.iam_account_settings.account_id | ||
rule_contexts = [{ | ||
attributes = [ | ||
{ | ||
"name" : "endpointType", | ||
"value" : "private" | ||
}, | ||
{ | ||
name = "networkZoneId" | ||
value = module.cbr_zone.zone_id | ||
}] | ||
}] | ||
} | ||
] | ||
} |
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,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 | ||
} |
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,4 @@ | ||
provider "ibm" { | ||
ibmcloud_api_key = var.ibmcloud_api_key | ||
region = var.region | ||
} |
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 "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 "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 = [] | ||
} | ||
|
||
variable "topics" { | ||
type = list(object( | ||
{ | ||
name = string | ||
partitions = number | ||
config = object({}) | ||
} | ||
)) | ||
description = "List of topics. For lite plan only one topic is allowed." | ||
default = [] | ||
} | ||
|
||
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 Event Streams instance." | ||
} |
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 @@ | ||
terraform { | ||
required_version = ">= 1.3.0" | ||
required_providers { | ||
# Use latest version of provider in non-basic examples to verify latest version works with module | ||
ibm = { | ||
source = "IBM-Cloud/ibm" | ||
version = ">= 1.56.1" | ||
} | ||
} | ||
} |
Oops, something went wrong.