Module fails to correctly calculate dependency on resource group: "Error: Resource Group "xxxxxxxxx-rg" was not found
Closed this issue · 5 comments
Is there an existing issue for this?
- I have searched the existing issues
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
Important
The "Needs: Triage 🔍" label must be removed once the triage process is complete!
Note
This label was added as per ITA06.
Faced the same issue... Had to add depends on to explicitely force the rg creation before the avm storage module.
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 🔍" 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.
@cbezenco @digorgonzola Data blocks have been removed from the code. This should be ok now.
Confirmed it is working for me now