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

Can imported resources apply their names to the Terraform resource? #413

Closed
MohnJadden opened this issue Jun 8, 2023 · 1 comment
Closed
Labels
duplicate This issue or pull request already exists

Comments

@MohnJadden
Copy link

If we're importing a whole resource group full of resources, aztfexport presently applies a res-### name to the resource. The ### is taken from a numeric value based on the order in which the resource appears.

For example - let's say I've got a resource group named Network, with one vnet, an NSG with five rules, and a subnet. It names the Terraform resources as:

  • azurerm_resource_group.res-0
  • azurerm_virtual_network.res-1
  • azurerm_network_security_group.res-2
  • azurerm_network_security_rule.res-3
  • azurerm_network_security_rule.res-4
  • azurerm_network_security_rule.res-5
  • azurerm_network_security_rule.res-6
  • azurerm_network_security_rule.res-7
  • azurerm_subnet.res-8

Instead of res-###, could the resource name be pulled from the name of the resource itself? e.g. the if the subnet is named Admin, instead of azurerm_subnet.res-8, it should be azurerm_subnet.Admin.

If there are duplicate names, it could use the Azure region as a disambiguation - for example if the Admin subnet exists in two vnets, one in East and one in West, it would have azurerm_subnet.Admin and azurerm_subnet.Admin-West.

This would make it easier to navigate the resources in the future - we could standardize and set dependencies based on names rather than having to pinpoint sequentially import-numbered resources.

@magodo
Copy link
Collaborator

magodo commented Jun 9, 2023

@MohnJadden Thank you for submitting this! This feature request is already asked in #183, I'll close this in favor of #183.

@magodo magodo closed this as completed Jun 9, 2023
@magodo magodo added the duplicate This issue or pull request already exists label Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants