Skip to content

terraform-yc-modules/terraform-yc-serverless

Repository files navigation

Serverless Terraform Module for Yandex.Cloud

Features

  • Create Event Router Bus
  • Create Event Router Connector of three types: timer, ymq, yds
  • Create Event Router Rule (or Rules) of seven types: container, function, gateway_websocket_broadcast, workflow, logging, yds, ymq
  • Easy to use in other resources via outputs

Serverless Event Router Bus definition

Notes:

  • service accounts with right permissions for different resources are created for you in the examples
  • 4 examples are provided for you: 1 with multiple connectors, 1 with multiple targets for rule, 1 with one rule and one connector, 1 with multiple rules

Serverless Event Router Connector definition

Notes:

  • connector must be of only one type (timer, ymq or yds)
  • you can use whether one connector or multiple ones

Serverless Event Router Rule definition

Notes:

  • you can use whether one rule or multiple ones
  • you can define multiple targets for each rule

Configure Terraform for Yandex Cloud

  • Install YC CLI
  • Add environment variables for terraform authentication in Yandex Cloud
export YC_TOKEN=$(yc iam create-token)
export YC_CLOUD_ID=$(yc config get cloud-id)
export YC_FOLDER_ID=$(yc config get folder-id)

Requirements

Name Version
terraform >= 1.0.0
yandex >= 0.108

Providers

Name Version
yandex 0.147.0

Modules

No modules.

Resources

Name Type
yandex_serverless_eventrouter_bus.main resource
yandex_serverless_eventrouter_connector.connectors resource
yandex_serverless_eventrouter_rule.rules resource
yandex_client_config.client data source

Inputs

Name Description Type Default Required
bus_description Description of the Event Router Bus string "Yandex Cloud EventRouter Bus" no
bus_labels Labels for the Event Router Bus map(string) {} no
bus_name Name of the Event Router Bus string "event-bus" no
connectors Example:
connectors = [
{
name = "timer-connector"
description = "Single timer-based connector"
timer = {
cron_expression = "0 0 12 * * ?"
}
}
]
list(object({
name = string
description = optional(string, "")
deletion_protection = optional(bool, false)
labels = optional(map(string), {})

timer = optional(object({
cron_expression = string
}))

ymq = optional(object({
queue_arn = string
service_account_id = string
batch_size = optional(number, 1)
}))

yds = optional(object({
stream_name = string
consumer = string
database = string
service_account_id = string
}))
}))
[] no
folder_id The ID of the folder that the resources belong to. string null no
rules Example:
rules = [
{
name = "mixed-rule"
description = "Rule for mixed connector types with logging"
jq_filter = ""

targets = [
{
logging = {
log_group_id = yandex_logging_group.example_log_group.id
service_account_id = yandex_iam_service_account.eventrouter_sa.id
}
}
]
}
]
list(object({
name = string
description = optional(string, "")
jq_filter = optional(string, "")
labels = optional(map(string), {})

targets = list(object({
container = optional(object({
container_id = string
container_revision_id = optional(string)
path = optional(string)
service_account_id = string
}))

function = optional(object({
function_id = string
function_tag = optional(string, "")
service_account_id = string
}))

gateway_websocket_broadcast = optional(object({
gateway_id = string
path = optional(string)
service_account_id = string
}))

workflow = optional(object({
workflow_id = string
service_account_id = string
}))

logging = optional(object({
log_group_id = string
service_account_id = string
}))

yds = optional(object({
stream_name = string
database = string
service_account_id = string
}))

ymq = optional(object({
queue_arn = string
service_account_id = string
}))
}))
}))
[] no

Outputs

Name Description
bus_id ID of the Event Router Bus
bus_name Name of the Event Router Bus
connector_ids IDs of the Event Router Connectors
connector_names Names of the Event Router Connectors
rule_ids IDs of the Event Router Rules
rule_names Names of the Event Router Rules

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages