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

Support for azurerm_network_manager data source #24199

Closed
1 task done
nathanblair opened this issue Dec 12, 2023 · 1 comment · Fixed by #24398
Closed
1 task done

Support for azurerm_network_manager data source #24199

nathanblair opened this issue Dec 12, 2023 · 1 comment · Fixed by #24398

Comments

@nathanblair
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 and review the contribution guide to help.

Description

There is currently a Terraform resource for the Azure Network Manager but the AzureRM provider lacks a data source for the same type of resource.

I'm unsure if its not possible to get the Network Manager as a data source and perhaps that's why this hasn't been done - but I didn't see any Issues reporting the data source as missing so maybe it just hasn't been thought of yet.

For now, in projects that don't directly consume the Network Manager (have the NM directly in terraform state) and want to, for instance, add static members to the network manager's groups, one can use the network manager group data source, but it in turn relies on the network manager ID.

My workaround for getting the network manager ID for the group in a different project is to have the network manager ID as an output and then import the terraform state of that project in the consuming project and reference its x.outputs.network_manager_id.

New or Affected Resource(s)/Data Source(s)

azurerm_network_manager

Potential Terraform Configuration

data "azurerm_network_manager" "main" {
  resource_group_name = local.general_resource_group_name

  name = "${local.organization_name}-${local.general_resource_group_name}-nm"
}

data "azurerm_network_manager_network_group" "context" {
  network_manager_id = data. azurerm_network_manager.network_manager_id

  name = "${local.organization_name}-${local.general_resource_group_name}-${local.general_context}-group"
}

resource "azurerm_network_manager_static_member" "services" {
  network_group_id          = data.terraform_remote_state.general.outputs.network_manager_id
  target_virtual_network_id = azurerm_virtual_network.app.id
  name                      = "${local.resource_name_prefix}-${local.context}-app-member"
}

References

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_manager

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 Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants