Using our Terraform modules, you can easily install and manage Coralogix integrations with Azure services as modules in your infrastructure code. This tutorial demonstrates how to install the Coralogix [function app](https://github.com/coralogix/coralogix-azure-serverless/tree/master/BlobToOtel), allowing you to connect your Blob Storage container and send logs to OTel Endpoint.

This function serves as a solution for the limitation of [azureblobreceiver in OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/azureblobreceiver), as it can't process non-JSON logs (see [this issue](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34997)).

Our modules are open-source and available on [Github](https://github.com/coralogix/terraform-coralogix-azure) and in the [Terraform registry](https://registry.terraform.io/modules/coralogix/azure/coralogix/latest).

## Prerequisites

- Azure account with an active subscription.
- Storage account where logs are stored with event notifications configured with EventHub as a destination.
- An OTel collector endpoint (available for the function app to reach).
- [Optional] vNet network with a subnet for the function app if you are using a Premium App Service Plan.

## Installation

Install our [function app](https://github.com/coralogix/coralogix-azure-serverless/tree/master/BlobToOtel) that connects to your Blob Storage container and sends logs to OTel Endpoint.

Add this declaration to your Terraform project:

```tf
terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "~> 3.93"
    }
  }
}

provider "azurerm" {
  features {}
}

# Standard version without vNet integration
module "blobtootel-standard" {
  source = "coralogix/azure/coralogix//modules/blobtootel"

  OtelEndpoint                   = "my-otel-endpoint.com:4318"
  FunctionResourceGroupName      = "my-function-resource-group"
  FunctionAppServicePlanType     = "Consumption"
  EventHubNamespace              = "my-eventhub-namespace"
  EventHubName                   = "my-eventhub-name"
  EventHubResourceGroup          = "my-eventhub-resource-group"
  BlobContainerStorageAccount    = "my-blob-container-storage-account"
  BlobContainerResourceGroupName = "my-blob-container-resource-group"
}

# Premium version with vNet integration (in case if there is a private connection to OTel endpoint)
module "blobtootel-vnet" {
  source = "coralogix/azure/coralogix//modules/blobtootel"

  OtelEndpoint                   = "my-otel-endpoint.com:4318"
  FunctionResourceGroupName      = "my-function-resource-group"
  FunctionAppServicePlanType     = "Premium"
  EventHubNamespace              = "my-eventhub-namespace"
  EventHubName                   = "my-eventhub-name"
  EventHubResourceGroup          = "my-eventhub-resource-group"
  BlobContainerStorageAccount    = "my-blob-container-storage-account"
  BlobContainerResourceGroupName = "my-blob-container-resource-group"
  VirtualNetworkName             = "my-virtual-network"
  SubnetName                     = "my-subnet"
  VirtualNetworkResourceGroup    = "my-virtual-network-resource-group"
}
```

- Descriptions for variables can be found [here](https://github.com/coralogix/terraform-coralogix-azure/blob/master/modules/blobtootel/README.md).

## Additional Resources

|                        |                                                                                                                                                               |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Documentation          | [Coralogix Terraform Provider](https://coralogix.com/docs/developer-portal/infrastructure-as-code/terraform-provider/coralogix-terraform-provider/index.md)   |
| External Documentation | [Github](https://github.com/coralogix/terraform-coralogix-azure) [Terraform Registry](https://registry.terraform.io/modules/coralogix/azure/coralogix/latest) |

## **Support**

**Need help?**

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us **via our in-app chat** or by sending us an email at [support@coralogix.com](mailto:support@coralogix.com).
