Skip to content

Commit

Permalink
fix: move kafka user configuration out to child modules
Browse files Browse the repository at this point in the history
  • Loading branch information
upendra-vedullapalli committed Mar 25, 2023
1 parent 62459af commit 1f7aa24
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
18 changes: 4 additions & 14 deletions modules/init/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,18 @@ data "aiven_service_component" "schema-registry" {
route = "dynamic"
}

data "aiven_kafka_user" "kafka_admin" {
project = data.aiven_project.entur-aiven-project.project
service_name = var.service_name
username = var.service_registry_username
}

locals {
aiven = {
access_token = var.access_token
project = data.aiven_project.entur-aiven-project.project
service = var.service_name
access_token = var.access_token
}
schema_registry = {
url = "https://${data.aiven_service_component.schema-registry.host}:${data.aiven_service_component.schema-registry.port}"
userinfo = "${data.aiven_kafka_user.kafka_admin.username}:${data.aiven_kafka_user.kafka_admin.password}"
schema_registry_url = "https://${data.aiven_service_component.schema-registry.host}:${data.aiven_service_component.schema-registry.port}"
}
default_configuration = {
"tasks.max" : var.tasks_max,
"key.converter" : var.key_converter,
"value.converter" : var.value_converter,
"value.converter.schema.registry.url" : local.schema_registry.url,
"value.converter.basic.auth.credentials.source" : "USER_INFO",
"value.converter.schema.registry.basic.auth.user.info" : local.schema_registry.userinfo
"value.converter.schema.registry.url" : local.aiven.schema_registry_url,
"value.converter.basic.auth.credentials.source" : "USER_INFO"
}
}
5 changes: 0 additions & 5 deletions modules/init/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ output "aiven" {
value = local.aiven
}

output "schema_registry" {
description = "Details of Kafka schema registry component of Aiven Kafka service"
value = local.schema_registry
}

output "default_configuration" {
description = "A map of default configuration options for any connector"
value = local.default_configuration
Expand Down
6 changes: 0 additions & 6 deletions modules/init/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ variable "service_name" {
type = string
}

variable "service_registry_username" {
description = "Aiven service registry username to connect to Kafka schema registry"
type = string
default = "avnadmin"
}

variable "tasks_max" {
type = number
description = "Maximum number of tasks that should be created for this connector. The connector may create fewer tasks if it cannot achieve this level of parallelism"
Expand Down

0 comments on commit 1f7aa24

Please sign in to comment.