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

azurecaf_name support for import #247

Open
kmataru opened this issue Jul 12, 2023 · 1 comment
Open

azurecaf_name support for import #247

kmataru opened this issue Jul 12, 2023 · 1 comment

Comments

@kmataru
Copy link

kmataru commented Jul 12, 2023

Is your feature request related to a problem? Please describe.
Working with terraform-azurerm-caf and having to import lots of cloud resources it leaves azurecaf_name
(even with passthrough = true) as a dependency to the actual resources.

Leaving the last ones in recreate state, even if the name is exactly the same.

  # module.solution.module.batch_accounts["batch_account"].azurecaf_name.account will be created
  + resource "azurecaf_name" "account" {
      + clean_input   = true
      + id            = (known after apply)
      + name          = "BA"
      + passthrough   = true
      + random_length = 0
      + resource_type = "azurerm_batch_account"
      + result        = (known after apply)
      + results       = (known after apply)
      + separator     = "-"
      + use_slug      = true
    }

  # module.solution.module.batch_accounts["batch_account"].azurerm_batch_account.account must be replaced
  # (imported from "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG/providers/Microsoft.Batch/batchAccounts/BA")
  # Warning: this will destroy the imported resource
-/+ resource "azurerm_batch_account" "account" {
      ~ account_endpoint                    = "BA._.batch.azure.com" -> (known after apply)
      ~ id                                  = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/RG/providers/Microsoft.Batch/batchAccounts/BA" -> (known after apply)
      ~ name                                = "BA" # forces replacement -> (known after apply) # forces replacement

Describe the solution you'd like
Probably it would defeat the whole purpose to have the ability to run the import command (somehow).
But I am raising this at a discussion level.

(Maybe this would be a topic for terraform-azurerm-caf project;
and instead of resource "azurecaf_name" there should be data "azurecaf_name")
Update: I was rethinking this and data "azurecaf_name" makes sense only when passthrough = true 😊

Describe alternatives you've considered
As silly as it seemed, I tried running the import command:
Error: resource azurecaf_name doesn't support import

@dmunkovpax8
Copy link

I think the scope of this issue is more then just with import, - it's with unnecessary "known after apply" status of the result output of azurecaf_name resource. Even when all inputs are known upfront, for some reason it can't assemble the name until apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants