generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added a new
Logs Routing
variation (#260)
- Loading branch information
Showing
13 changed files
with
292 additions
and
7 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
Submodule common-dev-assets
updated
11 files
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
4 changes: 4 additions & 0 deletions
4
reference-architecture/deployable-architecture-logs-routing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,30 @@ | ||
# Configuring Tenants for Log Routing to Cloud Logs Instances | ||
|
||
When you create a log router tenant from the IBM cloud catalog you can configure in which region you want to create the router tenant | ||
|
||
and which cloud logs instance you want to target and give names to the tenant and the target | ||
|
||
### Options for tenant configuration | ||
- `tenant_region` (required): The region in which the tenant will be created | ||
- `tenant_name` (required): The name of the tenant which has to be created | ||
- `target_name` (required): The name to be given to the target inside the tenant | ||
- `log_sink_crn` (required): The Cloud Resource Name (CRN) of the cloud logs instance where logs will be routed. | ||
|
||
### Example log router tenant configuration | ||
|
||
```hcl | ||
tenant_configuration = [ | ||
{ | ||
tenant_region = "eu-de" | ||
tenant_name = "test-tenant-1" | ||
target_name = "test-target-1" | ||
log_sink_crn = "crn:v1:bluemix:public:logs:us-south::2fde707d-7cb6-4aed-80df-ab038599872c::" | ||
}, | ||
{ | ||
tenant_region = "br-sao" | ||
tenant_name = "test-tenant-2" | ||
target_name = "test-target-2" | ||
log_sink_crn = "crn:v1:bluemix:public:logs:us-south::2fde707d-7cb6-4aed-80df-ab038599872c::" | ||
} | ||
] | ||
``` |
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,7 @@ | ||
# Creating Tenants for Log Routing to Cloud Logs Intances | ||
|
||
This architecture supports creating Cloud Logs tenants | ||
|
||
## Before you begin | ||
|
||
* Make sure that the observability instances (Cloud Logs) for which specific tenants are required are deployed. |
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 @@ | ||
{ | ||
"ibmcloud_api_key": $VALIDATION_APIKEY, | ||
"tenant_configuration": "[{\"tenant_region\": \"eu-de\", \"tenant_name\": \"test-tenant\", \"target_name\": \"test-target\", \"log_sink_crn\": \"crn:v1:bluemix:public:logs:us-east:a/abac0df06b644a9cabc6e44f55b3880e:6e931667-0f47-4c59-be2e-fa9b9f13f1a4::\"}]" | ||
} |
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,25 @@ | ||
module "icl_crn_parser" { | ||
for_each = { for idx, tenant in var.tenant_configuration : idx => tenant } | ||
source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser" | ||
version = "1.1.0" | ||
crn = each.value.log_sink_crn | ||
} | ||
|
||
data "ibm_resource_instance" "icl_instance" { | ||
for_each = { for idx, tenant in var.tenant_configuration : idx => tenant } | ||
identifier = module.icl_crn_parser[each.key].service_instance | ||
} | ||
|
||
resource "ibm_logs_router_tenant" "logs_router_tenant_instances" { | ||
for_each = { for idx, tenant in var.tenant_configuration : idx => tenant } | ||
name = each.value.tenant_name | ||
region = each.value.tenant_region | ||
targets { | ||
log_sink_crn = each.value.log_sink_crn | ||
name = each.value.target_name | ||
parameters { | ||
host = data.ibm_resource_instance.icl_instance[each.key].extensions.external_ingress_private | ||
port = 443 | ||
} | ||
} | ||
} |
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 @@ | ||
############################################################################## | ||
# Outputs | ||
############################################################################## | ||
|
||
|
||
############################################################################## | ||
|
||
output "tenants_details" { | ||
|
||
value = { | ||
for idx, tenant in var.tenant_configuration : idx => { | ||
"name" : var.tenant_configuration[idx].tenant_name, | ||
"id" : ibm_logs_router_tenant.logs_router_tenant_instances[idx].id, | ||
"crn" : ibm_logs_router_tenant.logs_router_tenant_instances[idx].crn | ||
} | ||
} | ||
description = "Details of tenant created through this configuration" | ||
} |
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,8 @@ | ||
######################################################################################################################## | ||
# Provider config | ||
######################################################################################################################## | ||
|
||
provider "ibm" { | ||
ibmcloud_api_key = var.ibmcloud_api_key | ||
visibility = var.provider_visibility | ||
} |
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,29 @@ | ||
variable "ibmcloud_api_key" { | ||
type = string | ||
description = "The API key to use for IBM Cloud." | ||
sensitive = true | ||
} | ||
|
||
variable "provider_visibility" { | ||
description = "Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints)." | ||
type = string | ||
default = "public" | ||
# NOTE. Provider visibility is set to public because of provider issue. (https://github.com/IBM-Cloud/terraform-provider-ibm/issues/5977) | ||
|
||
validation { | ||
condition = contains(["public", "private", "public-and-private"], var.provider_visibility) | ||
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'." | ||
} | ||
} | ||
|
||
variable "tenant_configuration" { | ||
|
||
description = "List of tenants to be created for log routing.[Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-observability-da/tree/main/solutions/tenants/DA-types.md)." | ||
type = list(object({ | ||
tenant_region = string | ||
tenant_name = string | ||
target_name = string | ||
log_sink_crn = string | ||
})) | ||
|
||
} |
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.9.0" | ||
|
||
required_providers { | ||
ibm = { | ||
source = "IBM-Cloud/ibm" | ||
version = "1.75.1" | ||
} | ||
} | ||
} |
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