Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_monitor_action_group event_hub_receiver no way to set resource_group_name #18322

Closed
1 task done
mpjtaylor opened this issue Sep 9, 2022 · 6 comments
Closed
1 task done
Labels

Comments

@mpjtaylor
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.2.4

AzureRM Provider Version

3.22.0

Affected Resource(s)/Data Source(s)

azurerm_monitor_action_group

Terraform Configuration Files

resource "azurerm_monitor_action_group" "support" {
  name                = "AlertsAction"
  resource_group_name = data.azurerm_resource_group.support.name
  short_name          = "alerts"

  event_hub_receiver {
    name                    = "s-alerts"
    event_hub_namespace     = local.management_monitor_namespace_name
    event_hub_name          = "e-alerts"
    subscription_id         = local.management_subscriptionid
    use_common_alert_schema = true
  }
  tags = local.common_tags
}

Debug Output/Panic Output

Error: in event_hub_receiver, exactly one of event_hub_id or (event_hub_namespace, event_hub_name) must be set
with module.terraform-azure_support.azurerm_monitor_action_group.support
on .terraform/modules/terraform-azure_support/log_analytics_workspace.tf line 11, in resource "azurerm_monitor_action_group" "support":

Expected Behaviour

No response

Actual Behaviour

No response

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

@mpjtaylor mpjtaylor added the bug label Sep 9, 2022
@github-actions github-actions bot removed the bug label Sep 9, 2022
@teowa
Copy link
Contributor

teowa commented Sep 13, 2022

Hi @mpjtaylor , thanks for submitting this issue, seems I cannot repro the issue with given config. Could you please try the below config? As for no way to set resource_group_name in event_hub_receiver, it is by API design, because event_hub_namespace is unique, see #17335 (comment).

TF config
provider "azurerm" {
  features {
  }
}

resource "azurerm_resource_group" "example" {
  name     = "test-ag"
  location = "eastus"
}

resource "azurerm_eventhub_namespace" "example" {
  name                = "aTestEventHubNamespace-123"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  sku                 = "Standard"
  capacity            = 1
}

resource "azurerm_eventhub" "example" {
  name                = "aTestEventHub"
  namespace_name      = azurerm_eventhub_namespace.example.name
  resource_group_name = azurerm_resource_group.example.name
  partition_count     = 1
  message_retention   = 1
}

resource "azurerm_monitor_action_group" "example" {
  name                = "testactiongroup"
  resource_group_name = azurerm_resource_group.example.name
  short_name          = "atest"
  event_hub_receiver {
    name                    = "eventhub-test-action"
    event_hub_name          = azurerm_eventhub.example.name
    event_hub_namespace     = azurerm_eventhub.example.namespace_name
    use_common_alert_schema = true
  }
}

@mpjtaylor
Copy link
Author

Hi,

the action group is in a different subscription to the event hub, without using the deprecated id there is no way using the below that the connection can be made no resource group is known?

  event_hub_receiver {
    name                                      = "sendtoeventhub"
    event_hub_namespace          = "eventhubnamespace"
    event_hub_name                   = "eventhub1"
    subscription_id                     = "00000000-0000-0000-0000-000000000000"
    use_common_alert_schema = false
  }    

@teowa
Copy link
Contributor

teowa commented Sep 13, 2022

Hi @mpjtaylor , the resource_group_name is actually a redundant parameter, because we cannot create two same named eventhub namespace under one subscription. And even with the deprecated id, the resource group name is not send to the REST API. With event_hub_namespace, event_hub_name, subscription_id, a specific eventhub can be confirmed.

@mpjtaylor
Copy link
Author

Ok, this can be closed I was expecting to need resource group

Thanks

@tombuildsstuff
Copy link
Contributor

Closing per above

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants