skip to Main Content

What is the way we can disable public network access using Terrform for Azure Event Hub

I selected options public_network_access_enabled as false and public_network_access as false under network_rulesset block and following error

"public_network_access_enabled" is not expected here.

I am not sure what I am missing here…any support would be great help here.

2

Answers


  1. As you say the attribute public_network_access_enabled does not exist in the module azurerm_eventhub

    The attribute public_network_access_enabled it is part of the module azurerm_eventhub_namespace

    public_network_access_enabled – (Optional) Is public network access enabled for the EventHub Namespace? Defaults to true.

    Source: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/eventhub_namespace#public_network_access_enabled

    For example:

    resource "azurerm_eventhub_namespace" "example" {
      name                          = "example-namespace"
      location                      = azurerm_resource_group.example.location
      resource_group_name           = azurerm_resource_group.example.name
      SKU                           = "Standard"
      capacity                      = 2
      public_network_access_enabled = false # Default is true
    
      tags = {
        environment = "Production"
      }
    }
    
    Login or Signup to reply.
  2. Better if you can provide more details about how you have configured the access to your Azure Event Hub Namespace. Because, if you have disabled the public access, you need to enable access via private endpoints. In that case, you need to correctly use public_network_access_enabled property in both namespace level and network_rulesets level.

    If you are using hashicorp as the provider, check the latest documentations for this in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/eventhub_namespace#network_rulesets

    Note:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search