Azure / terraform-azurerm-avm-res-storage-storageaccount

This Terraform module is designed to create Azure Storage Accounts and its related resources, including blob containers, queues, tables, and file shares. It also supports the creation of a storage account private endpoint which provides secure and direct connectivity to Azure Storage over a private network.
https://registry.terraform.io/modules/Azure/avm-res-storage-storageaccount
MIT License
19 stars 27 forks source link

Module fails to correctly calculate dependency on resource group: "Error: Resource Group "xxxxxxxxx-rg" was not found #90

Closed digorgonzola closed 3 months ago

digorgonzola commented 4 months ago

Is there an existing issue for this?

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.7.5

Module Version

0.1.1

AzureRM Provider Version

3.102.0

Affected Resource(s)/Data Source(s)

data.azurerm_resource_group.rg

Terraform Configuration Files

provider "azurerm" {
  features {}
  subscription_id = var.subscription_id
  tenant_id       = var.tenant_id
  use_cli         = true
}

resource "azurerm_resource_group" "my_rg" {
  location = "Australia East"
  name     = "my-rg"
  tags     = merge({}, var.default_tags)
}

# Key Vault wrapper module
module "storage_account" {
  source  = "Azure/avm-res-storage-storageaccount/azurerm"
  version = "~> 0.1.1"

  name                = "mystorageaccount"
  resource_group_name = azurerm_resource_group.my_rg.name
  location            = azurerm_resource_group.my_rg.location

  enable_telemetry              = false
  public_network_access_enabled = true
  network_rules                 = null
  shared_access_key_enabled     = true

  tags = merge({}, var.default_tags)

}

tfvars variables values

N/A

Debug Output/Panic Output

╷
│ Error: Error: Resource Group "xxxxxxxx-rg" was not found
│
│   with module.xxxxxxxxxxxx.data.azurerm_resource_group.rg,
│   on .terraform\modules\xxxxxxxxxx\main.tf line 3, in data "azurerm_resource_group" "rg":
│    3: data "azurerm_resource_group" "rg" {
│
╵

Expected Behaviour

Terraform plan succeeds

Actual Behaviour

Terraform plan fails with error:

Steps to Reproduce

terraform plan

Important Factoids

No response

References

No response

microsoft-github-policy-service[bot] commented 4 months ago

[!IMPORTANT] The "Needs: Triage :mag:" label must be removed once the triage process is complete!

[!NOTE] This label was added as per ITA06.

cbezenco commented 4 months ago

Faced the same issue... Had to add depends on to explicitely force the rg creation before the avm storage module.

microsoft-github-policy-service[bot] commented 3 months ago

[!WARNING] Tagging the AVM Core Team (@Azure/avm-core-team-technical-terraform) due to a module owner or contributor having not responded to this issue within 3 business days. The AVM Core Team will attempt to contact the module owners/contributors directly.

[!TIP]

  • To prevent further actions to take effect, the "Status: Response Overdue 🚩" label must be removed, once this issue has been responded to.
  • To avoid this rule being (re)triggered, the ""Needs: Triage :mag:" label must be removed as part of the triage process (when the issue is first responded to)!

[!NOTE] This message was posted as per ITA01TF.

chinthakaru commented 3 months ago

@cbezenco @digorgonzola Data blocks have been removed from the code. This should be ok now.

digorgonzola commented 3 months ago

Confirmed it is working for me now