» azurerm_notification_hub

Manages a Notification Hub within a Notification Hub Namespace.

» Example Usage

resource "azurerm_resource_group" "test" {
  name     = "notificationhub-resources"
  location = "Australia East"
}

resource "azurerm_notification_hub_namespace" "test" {
  name                = "myappnamespace"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "${azurerm_resource_group.test.location}"
  namespace_type      = "NotificationHub"

  sku {
    name = "Free"
  }
}

resource "azurerm_notification_hub" "test" {
  name                = "mynotificationhub"
  namespace_name      = "${azurerm_notification_hub_namespace.test.name}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "${azurerm_resource_group.test.location}"
}

» Argument Reference

The following arguments are supported:

  • name - (Required) The name to use for this Notification Hub. Changing this forces a new resource to be created.

  • namespace_name - (Required) The name of the Notification Hub Namespace in which to create this Notification Hub. Changing this forces a new resource to be created.

  • resource_group_name - (Required) The name of the Resource Group in which the Notification Hub Namespace exists. Changing this forces a new resource to be created.

  • location - (Required) The Azure Region in which this Notification Hub Namespace exists. Changing this forces a new resource to be created.

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

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

A apns_credential block contains:

  • application_mode - (Required) The Application Mode which defines which server the APNS Messages should be sent to. Possible values are Production and Sandbox.

  • bundle_id - (Required) The Bundle ID of the iOS/macOS application to send push notifications for, such as com.hashicorp.example.

  • key_id - (Required) The Apple Push Notifications Service (APNS) Key.

  • team_id - (Required) The ID of the team the Token.

  • token - (Required) The Push Token associated with the Apple Developer Account. This is the contents of the key downloaded from the Apple Developer Portal between the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- blocks.


A gcm_credential block contains:

  • api_key - (Required) The API Key associated with the Google Cloud Messaging service.

» Attributes Reference

The following attributes are exported:

  • id - The ID of the Notification Hub.

» Import

Notification Hubs can be imported using the resource id, e.g.

terraform import azurerm_notification_hub.hub1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/hub1