Skip to content

azurermAppServiceHybridConnection

Manages an App Service Hybrid Connection for an existing App Service, Relay and Service Bus.

!> NOTE: This resource has been deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use azurermFunctionAppHybridConnection and azurermWebAppHybridConnection resources instead.

Example Usage

This example provisions an App Service, a Relay Hybrid Connection, and a Service Bus using their outputs to create the App Service Hybrid Connection.

/*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: "exampleResourceGroup1",
  }
);
const azurermAppServicePlanExample = new azurerm.appServicePlan.AppServicePlan(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "exampleAppServicePlan1",
    resource_group_name: azurermResourceGroupExample.name,
    sku: [
      {
        size: "S1",
        tier: "Standard",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAppServicePlanExample.overrideLogicalId("example");
const azurermRelayNamespaceExample = new azurerm.relayNamespace.RelayNamespace(
  this,
  "example_2",
  {
    location: azurermResourceGroupExample.location,
    name: "exampleRN1",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "Standard",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRelayNamespaceExample.overrideLogicalId("example");
const azurermAppServiceExample = new azurerm.appService.AppService(
  this,
  "example_3",
  {
    app_service_plan_id: azurermAppServicePlanExample.id,
    location: azurermResourceGroupExample.location,
    name: "exampleAppService1",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAppServiceExample.overrideLogicalId("example");
const azurermRelayHybridConnectionExample =
  new azurerm.relayHybridConnection.RelayHybridConnection(this, "example_4", {
    name: "exampleRHC1",
    relay_namespace_name: azurermRelayNamespaceExample.name,
    resource_group_name: azurermResourceGroupExample.name,
    user_metadata: "examplemetadata",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRelayHybridConnectionExample.overrideLogicalId("example");
const azurermAppServiceHybridConnectionExample =
  new azurerm.appServiceHybridConnection.AppServiceHybridConnection(
    this,
    "example_5",
    {
      app_service_name: azurermAppServiceExample.name,
      hostname: "testhostname.example",
      port: 8080,
      relay_id: azurermRelayHybridConnectionExample.id,
      resource_group_name: azurermResourceGroupExample.name,
      send_key_name: "exampleSharedAccessKey",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAppServiceHybridConnectionExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • appServiceName - (Required) Specifies the name of the App Service. Changing this forces a new resource to be created.

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

  • relayId - (Required) The ID of the Service Bus Relay. Changing this forces a new resource to be created.

  • hostname - (Required) The hostname of the endpoint.

  • port - (Required) The port of the endpoint.

  • sendKeyName - (Optional) The name of the Service Bus key which has Send permissions. Defaults to rootManageSharedAccessKey.

Attributes Reference

The following attributes are exported:

  • id - The ID of the App Service.

  • namespaceName - The name of the Relay Namespace.

  • sendKeyValue - The value of the Service Bus Primary Access key.

  • serviceBusNamespace - The name of the Service Bus namespace.

  • serviceBusSuffix - The suffix for the service bus endpoint.

Timeouts

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

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

Import

App Service Hybrid Connections can be imported using the resourceId, e.g.

terraform import azurerm_app_service_hybrid_connection.example /subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/exampleResourceGroup1/providers/Microsoft.Web/sites/exampleAppService1/hybridConnectionNamespaces/exampleRN1/relays/exampleRHC1