data-platform-hq / terraform-azurerm-debezium

Terraform module for Debezium provisioning using Azure Container Instance

Home Page:https://registry.terraform.io/modules/data-platform-hq/debezium/azurerm/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure Container Instance with Debezium Terraform module

Terraform module for creation of Azure Container Instance with Debezium Connector

Usage

This module is provisioning Debezium container connect to Azure Sql Database and Azure Event Hub

locals {
  eventhub_topic = {
    db-history-topic = { partition_count = 1, message_retention = 7, permissions = ["listen","send","manage"] }
  }
  tags = {
    environment = "development"
  }
  
  mssql_database_name = "WideWorldImporters-Standard"
  mssql_tables        = ["schema_example.table_name_example"]
  
  # Object id of Azure-managed enterprise application 'Azure Container Instance Service'
  container_group_object_id = "8120c8cf-c03f-4bb8-b319-603a3ab38e4d" 
  
  # Here, create map of target Key Vault name to it's id:
  key_vault_name_to_id_map  = { 
    (module.key_vault.name) = module.key_vault.id 
  }
}

data "azurerm_client_config" "current" {}

module "eventhub" {
  source  = "data-platform-hq/eventhub/azurerm"

  project        = "datahq"
  env            = "dev"
  location       = "eastus"
  tags           = local.tags
  resource_group = "example-rg"
  eventhub_topic = local.eventhub_topic
}

module "logic_app_workflow" {
  source  = "data-platform-hq/logic-app-workflow/azurerm"

  project        = "datahq"
  env            = "dev"
  location       = "eastus"
  name           = "debezium"
  tags           = local.tags
  resource_group = "example-rg"
}

module "debezium" {
  source   = "data-platform-hq/terraform-azurerm-debezium

  project                    = "datahq"
  env                        = "dev"
  location                   = "eastus"
  resource_group             = "example-rg"
  tags                       = local.tags
  
  eventhub_name              = module.eventhub.namespace_name
  eventhub_connection_string = module.eventhub.namespace_connection_string
  
  # CMK encryption specific variables
  key_vault_id               = local.key_vault_name_to_id_map
  tenant_id                  = data.azurerm_client_config.current.tenant_id
  container_group_object_id  = local.container_group_object_id
  
  # Azure SQL specific variables
  mssql_server_name   = "example-server"
  mssql_username      = "admin"
  mssql_password      = "example-azure-sql-password"
  mssql_database_name = local.mssql_db_name
  sql_tables          = local.mssql_tables
  
  logic_app_workflow_id  = module.logic_app_workflow.id
}

Requirements

Name Version
terraform >= 1.0.0
azurerm >= 3.23.0
http >= 3.2.1

Providers

Name Version
azurerm >= 3.24.0
http >= 3.2.1

Modules

No modules.

Resources

Name Type
azurerm_key_vault_key.this resource
azurerm_key_vault_access_policy.this resource
azurerm_container_group.this resource
azurerm_logic_app_trigger_http_request.this resource
azurerm_logic_app_action_custom.config_name resource
azurerm_logic_app_action_custom.config_payload resource
azurerm_logic_app_action_custom.method resource
azurerm_logic_app_action_custom.if_condition resource
azurerm_logic_app_action_custom.switch resource
data.http.this resource

Inputs

Name Description Type Default Required
project Project name string n/a yes
env Environment name string n/a yes
resource_group The name of the resource group in which resources is created string n/a yes
location Specifies the supported Azure location where the resource exists string n/a yes
tags A mapping of tags to assign to the resource map(string) {} no
container_config Version and capacity config for container
map(object({
image = string
cpu = string
memory = string
}))
"debezium" = {
image = "debezium/connect:1.9",
cpu = "2",
memory = "4"
}
no
aci_ip_address_type Ip address type on Container Instance string "Public" no
aci_os_type Container Instance os type string "Linux" no
aci_restart_policy Container Instance restart policy string "Never" no
mssql_server_name Azure sql server name string n/a yes
mssql_database_name Azure sql database string " " no
sql_tables Azure sql tables names list(string) [] no
connection_string Azurerm eventhub namespace connection string string n/a yes
eventhub_name Azure eventhub name string n/a yes
mssql_username Azure sql user string n/a yes
mssql_password Azure sql user password string n/a yes
key_type Key Type to use for this Key Vault Key: (EC,EC-HSM,RSA,RSA-HSM) string "RSA" no
key_size Size of the RSA key to create in bytes, requied for RSA & RSA-HSM: (1024 - 2048) number 2048 no
key_opts JSON web key operations: (decrypt,encrypt,sign,unwrapKey,verify,wrapKey) list(string)
[
"decrypt",
"encrypt",
"sign",
"unwrapKey",
"verify",
"wrapKey"
]
no
access_policy_permissions List of key permissions list(string)
[
"Get",
"List",
"Verify",
"WrapKey",
"UnwrapKey"
]
no
key_vault_id Key Vault Name to ID map map(string) {} no
container_group_object_id Azure Container Group Instance Service object id, used to create Key Vault Access Policy for Container Group identity string "8120c8cf-c03f-4bb8-b319-603a3ab38e4d" no
tenant_id Tenant id where Azure Container Group Instance Service identity is assigned string " " no
debezium_history_topic Database history eventhub topic string "db-history-topic" no
connector_config_name Debezium SQL Connector name to give string "mssql-config" no
logic_app_workflow_id Id of Logic App Workflow where Actions would be created string n/a yes

Outputs

Name Description
container_name Name of the Azure Container Instance where Debezium executes
container_id Id of the Azure Container Instance where Debezium executes
container_ip_addresss Public IP address of the Azure Container Instance where Debezium executes
identity List of identities assigned to the Azure Container Instance
cmk_key_id Customer Managed Key Id, used to encrypt disks on Azure Container Instance
trigger_callback_url URL to trigger Logic App Workflow
status_code HTTP response status code

License

Apache 2 Licensed. For more information please see LICENSE

About

Terraform module for Debezium provisioning using Azure Container Instance

https://registry.terraform.io/modules/data-platform-hq/debezium/azurerm/latest

License:Apache License 2.0


Languages

Language:HCL 100.0%