I'm new to Terraform, and I'm trying to import two different existing Azure Storage Accounts into two "azurerm_storage_account" modules I'm creating in Terraform, "my_storage_account" and "my_storage_account_2".
I followed the Terraform import documentation and ran:
terraform import azurerm_storage_account.my_storage_account /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount
...but got the following error message:
Error: resource address "azurerm_storage_account.my_storage_account" does not exist in the configuration.
Before importing this resource, please create its configuration in the root module. For example:
resource "azurerm_storage_account" "my_storage_account" {
# (resource arguments)
}
Inside the root module, I have:
resource "azurerm_storage_account" "storage_account" {
# (resource arguments)
}
It sounds like the error message is telling me to write "storage_account" instead of "my_storage_account", but how can I then import to a specific module of that resource?