Skip to content

azurermMediaLiveEvent

Manages a Live Event.

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: "media-resources",
  }
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "GRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "examplestoracc",
    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.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermMediaServicesAccountExample =
  new azurerm.mediaServicesAccount.MediaServicesAccount(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "examplemediaacc",
    resource_group_name: azurermResourceGroupExample.name,
    storage_account: [
      {
        id: azurermStorageAccountExample.id,
        is_primary: true,
      },
    ],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMediaServicesAccountExample.overrideLogicalId("example");
const azurermMediaLiveEventExample = new azurerm.mediaLiveEvent.MediaLiveEvent(
  this,
  "example_3",
  {
    description: "My Event Description",
    encoding: [
      {
        key_frame_interval: "PT2S",
        preset_name: "Default720p",
        stretch_mode: "AutoFit",
        type: "Standard",
      },
    ],
    hostname_prefix: "special-event",
    input: [
      {
        ip_access_control_allow: [
          {
            address: "0.0.0.0",
            name: "AllowAll",
            subnet_prefix_length: 0,
          },
        ],
        streaming_protocol: "RTMP",
      },
    ],
    location: azurermResourceGroupExample.location,
    media_services_account_name: azurermMediaServicesAccountExample.name,
    name: "example",
    preview: [
      {
        ip_access_control_allow: [
          {
            address: "0.0.0.0",
            name: "AllowAll",
            subnet_prefix_length: 0,
          },
        ],
      },
    ],
    resource_group_name: azurermResourceGroupExample.name,
    stream_options: ["LowLatency"],
    transcription_languages: ["en-US"],
    use_static_hostname: true,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMediaLiveEventExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • input - (Required) A input block as defined below.

  • location - (Required) The Azure Region where the Live Event should exist. Changing this forces a new Live Event to be created.

  • mediaServicesAccountName - (Required) The Media Services account name. Changing this forces a new Live Event to be created.

  • name - (Required) The name which should be used for this Live Event. Changing this forces a new Live Event to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Live Event should exist. Changing this forces a new Live Event to be created.


  • autoStartEnabled - (Optional) The flag indicates if the resource should be automatically started on creation. Default is false. Changing this forces a new resource to be created.

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

  • description - (Optional) A description for the live event.

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

  • hostnamePrefix - (Optional) When useStaticHostname is set to true, the hostnamePrefix specifies the first part of the hostname assigned to the live event preview and ingest endpoints. The final hostname would be a combination of this prefix, the media service account name and a short code for the Azure Media Services data center.

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

  • streamOptions - (Optional) A list of options to use for the LiveEvent. Possible values are default, lowLatency, lowLatencyV2. Please see more at this document. Changing this forces a new resource to be created.

  • tags - (Optional) A mapping of tags which should be assigned to the Live Event.

  • transcriptionLanguages - (Optional) Specifies a list of languages (locale) to be used for speech-to-text transcription – it should match the spoken language in the audio track. The value should be in bcp47 format (e.g: enUs). See the Microsoft Documentation for more information about the live transcription feature and the list of supported languages.

  • useStaticHostname - (Optional) Specifies whether a static hostname would be assigned to the live event preview and ingest endpoints. Changing this forces a new Live Event to be created.


A crossSiteAccessPolicy block supports the following:

  • clientAccessPolicy - (Optional) The content of clientaccesspolicy.xml used by Silverlight.

  • crossDomainPolicy - (Optional) The content of the Cross Domain Policy (crossdomainXml).


A encoding block supports the following:

  • keyFrameInterval - (Optional) Use an iso8601 time value between 0.5 to 20 seconds to specify the output fragment length for the video and audio tracks of an encoding live event. For example, use pt2S to indicate 2 seconds. For the video track it also defines the key frame interval, or the length of a GoP (group of pictures). If this value is not set for an encoding live event, the fragment duration defaults to 2 seconds. The value cannot be set for pass-through live events.

  • presetName - (Optional) The optional encoding preset name, used when type is not none. If the type is set to standard, then the default preset name is default720P. Else if the type is set to premium1080P, the default preset is default1080P. Changing this forces a new resource to be created.

  • stretchMode - (Optional) Specifies how the input video will be resized to fit the desired output resolution(s). Allowed values are none, autoFit or autoSize. Default is none.

  • type - (Optional) Live event type. Allowed values are none, premium1080P or standard. When set to none, the service simply passes through the incoming video and audio layer(s) to the output. When type is set to standard or premium1080P, a live encoder transcodes the incoming stream into multiple bitrates or layers. Defaults to none. Changing this forces a new resource to be created.

-> More information can be found in the Microsoft Documentation.


A input block supports the following:

  • accessToken - (Optional) A UUID in string form to uniquely identify the stream. If omitted, the service will generate a unique value. Changing this forces a new value to be created.

  • ipAccessControlAllow - (Optional) One or more ipAccessControlAllow blocks as defined below.

  • keyFrameIntervalDuration - (Optional) ISO 8601 time duration of the key frame interval duration of the input. This value sets the extXTargetduration property in the HLS output. For example, use PT2S to indicate 2 seconds. This field cannot be set when type is set to encoding.

  • streamingProtocol - (Optional) The input protocol for the live event. Allowed values are fragmentedMp4 and rtmp. Changing this forces a new resource to be created.


A ipAccessControlAllow block supports the following:

  • address - (Optional) The IP address or CIDR range.

  • name - (Optional) The friendly name for the IP address range.

  • subnetPrefixLength - (Optional) The subnet mask prefix length (see CIDR notation).


A preview block supports the following:

  • alternativeMediaId - (Optional) An alternative media identifier associated with the streaming locator created for the preview. The identifier can be used in the customLicenseAcquisitionUrlTemplate or the customKeyAcquisitionUrlTemplate of the Streaming Policy specified in the streamingPolicyName field.

  • ipAccessControlAllow - (Optional) One or more ipAccessControlAllow blocks as defined above.

  • previewLocator - (Optional) The identifier of the preview locator in GUID format. Specifying this at creation time allows the caller to know the preview locator url before the event is created. If omitted, the service will generate a random identifier. Changing this forces a new resource to be created.

  • streamingPolicyName - (Optional) The name of streaming policy used for the live event preview. Changing this forces a new resource to be created.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Live Event.

Timeouts

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

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

Import

Live Events can be imported using the resourceId, e.g.

terraform import azurerm_media_live_event.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Media/mediaServices/account1/liveEvents/event1