Workaround for "Error: invalid value for name (EventGrid Topics)" during Cortex Cloud Azure Outpost Deployment

Workaround for "Error: invalid value for name (EventGrid Topics)" during Cortex Cloud Azure Outpost Deployment

211
Created On 07/09/25 22:37 PM - Last Modified 10/16/25 19:25 PM


Symptom


Upon running the Terraform script to deploy Cortex Cloud Azure Outpost, the following error is encountered:

│ Error: invalid value for name (EventGrid Topics name must be 3 - 128 characters long, contain only letters, numbers and hyphens.)
│ 
│   with module.location["ukwest"].azurerm_eventgrid_system_topic.eventgrid_topic,
│   on azure_outpost_cwp_agentless_single_region/resources-azurerm-eventgrid-system-topic.tf line 2, in resource "azurerm_eventgrid_system_topic" "eventgrid_topic":
│    2:   name                   = "${var.subscription_name}-eg-topic-${var.location}"
│ 



Environment


  • Cortex Cloud (Tested on v1.2 and before)
  • Microsoft Azure CSP
  • Azure Subscription name containing a special character (except hyphen)


Cause


The root cause is an Azure Subscription name containing a special character (excluding hyphens). The Subscription name is used to name other resources, which do not allow the same naming conventions. Therefore a modification to the Terraform script is necessary for successful onboarding.



Resolution


  1. Modify the following 2 Terraform files as described:

    resources-azurerm-eventgrid-event-subscription.tf

    Original Line: name = "${var.subscription_name}-bc-eg-sub-${var.location}"
    Updated Line: name = "${replace(var.subscription_name, "_", "-")}-bc-eg-sub-${var.location}"

    resources-azurerm-eventgrid-system-topic.tf

    Original Line: name = "${var.subscription_name}-eg-topic-${var.location}"
    Updated Line: name = "${replace(var.subscription_name, "_", "-")}-eg-topic-${var.location}"

  2. If the Subscription name contains multiple special characters, nested replaces will be necessary. For example: name = "${replace(replace(var.subscription_name, "_", "-"), "*", "-")}-eg-topic-${var.location}"

  3. Apply the Terraform configuration.


Additional Information


These changes replace all underscores in a Subscription ID with hyphens, which are allowed in EventGrid Topic names. The nested replace line replaces all underscores and asterisks.



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1Ki000000TNWwKAO&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail