Skip to content

azurermSignalrService

Manages an Azure SignalR service.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "terraform-signalr",
  }
);
const azurermSignalrServiceExample = new azurerm.signalrService.SignalrService(
  this,
  "example_1",
  {
    connectivity_logs_enabled: true,
    cors: [
      {
        allowed_origins: ["http://www.example.com"],
      },
    ],
    location: azurermResourceGroupExample.location,
    messaging_logs_enabled: true,
    name: "tfex-signalr",
    public_network_access_enabled: false,
    resource_group_name: azurermResourceGroupExample.name,
    service_mode: "Default",
    sku: [
      {
        capacity: 1,
        name: "Free_F1",
      },
    ],
    upstream_endpoint: [
      {
        category_pattern: ["connections", "messages"],
        event_pattern: ["*"],
        hub_pattern: ["hub1"],
        url_template: "http://foo.com",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSignalrServiceExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the SignalR service. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which to create the SignalR service. Changing this forces a new resource to be created.

  • location - (Required) Specifies the supported Azure location where the SignalR service exists. Changing this forces a new resource to be created.

  • sku - (Required) A sku block as documented below.

  • cors - (Optional) A cors block as documented below.

  • connectivityLogsEnabled - (Optional) Specifies if Connectivity Logs are enabled or not. Defaults to false.

  • messagingLogsEnabled - (Optional) Specifies if Messaging Logs are enabled or not. Defaults to false.

  • liveTraceEnabled - (Optional) Specifies if Live Trace is enabled or not. Defaults to false.

  • identity - (Optional) An identity block as defined below.

  • publicNetworkAccessEnabled - (Optional) Whether to enable public network access? Defaults to true.

\~> Note: publicNetworkAccessEnabled cannot be set to false in free sku tier.

  • localAuthEnabled - (Optional) Whether to enable local auth? Defaults to true.

  • aadAuthEnabled - (Optional) Whether to enable AAD auth? Defaults to true.

  • tlsClientCertEnabled - (Optional) Whether to request client certificate during TLS handshake? Defaults to false.

\~> Note: tlsClientCertEnabled cannot be set to true in free sku tier.

  • serverlessConnectionTimeoutInSeconds - (Optional) Specifies the client connection timeout. Defaults to 30.

  • serviceMode - (Optional) Specifies the service mode. Possible values are classic, default and serverless. Defaults to default.

  • upstreamEndpoint - (Optional) An upstreamEndpoint block as documented below. Using this block requires the SignalR service to be Serverless. When creating multiple blocks they will be processed in the order they are defined in.

  • liveTrace - (Optional) A liveTrace block as defined below.

  • tags - (Optional) A mapping of tags to assign to the resource.


A cors block supports the following:

  • allowedOrigins - (Required) A list of origins which should be able to make cross-origin calls. * can be used to allow all calls.

An upstreamEndpoint block supports the following:

  • urlTemplate - (Required) The upstream URL Template. This can be a url or a template such as http://hostCom/{hub}/api/{category}/{event}.

  • categoryPattern - (Required) The categories to match on, or * for all.

  • eventPattern - (Required) The events to match on, or * for all.

  • hubPattern - (Required) The hubs to match on, or * for all.


A liveTrace block supports the following:

  • enabled - (Optional) Whether the live trace is enabled? Defaults to true.

  • messagingLogsEnabled - (Optional) Whether the log category messagingLogs is enabled? Defaults to true

  • connectivityLogsEnabled - (Optional) Whether the log category connectivityLogs is enabled? Defaults to true

  • httpRequestLogsEnabled - (Optional) Whether the log category httpRequestLogs is enabled? Defaults to true


A sku block supports the following:

  • name - (Required) Specifies which tier to use. Valid values are freeF1, standardS1 and premiumP1.

  • capacity - (Required) Specifies the number of units associated with this SignalR service. Valid values are 1, 2, 5, 10, 20, 50 and 100.


An identity block supports the following:

  • type - (Required) Specifies the type of Managed Service Identity that should be configured on this signalR. Possible values are systemAssigned, userAssigned.

  • identityIds - (Optional) Specifies a list of User Assigned Managed Identity IDs to be assigned to this signalR.

\~> NOTE: This is required when type is set to userAssigned

Attributes Reference

The following attributes are exported:

  • id - The ID of the SignalR service.

  • hostname - The FQDN of the SignalR service.

  • ipAddress - The publicly accessible IP of the SignalR service.

  • publicPort - The publicly accessible port of the SignalR service which is designed for browser/client use.

  • serverPort - The publicly accessible port of the SignalR service which is designed for customer server side use.

  • primaryAccessKey - The primary access key for the SignalR service.

  • primaryConnectionString - The primary connection string for the SignalR service.

  • secondaryAccessKey - The secondary access key for the SignalR service.

  • secondaryConnectionString - The secondary connection string for the SignalR service.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the SignalR Service.
  • update - (Defaults to 30 minutes) Used when updating the SignalR Service.
  • read - (Defaults to 5 minutes) Used when retrieving the SignalR Service.
  • delete - (Defaults to 30 minutes) Used when deleting the SignalR Service.

Import

SignalR services can be imported using the resourceId, e.g.

terraform import azurerm_signalr_service.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/terraform-signalr/providers/Microsoft.SignalRService/signalR/tfex-signalr