-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_storage_share_file issue with for_each loops #15895
Comments
@benkelly89 I've locally tested with below config, it works fine for me: locals {
files = toset(["a.txt", "b.txt"])
}
#...
resource "azurerm_storage_share_file" "example" {
for_each = local.files
name = "mycontent-${each.key}"
storage_share_id = azurerm_storage_share.example.id
source = each.key
} Could you please share the TF config which can reproduce this issue? |
Hi This is the code, locals {
content_file_list = { for entry in flatten([for key in keys(local.vm_list) : [for file in fileset("${path.module}/palo/content","*") : {instance = key,file = file}]]) : "${entry.instance}_${replace(entry.file,".","-")}" => entry }
}
resource "azurerm_storage_share_file" "pa_content" {
for_each = local.content_file_list
name = each.value.file
path = azurerm_storage_share_directory.content[each.value.instance].name
storage_share_id = azurerm_storage_share.pa-bootstrap.id
source = "${path.module}/palo/content/${each.value.file}"
} This will generate a sample map as obviously the above references locals that aren't apparent Basically we are bootstrapping Palo Alto's, we have to create a bootstrap package per Palo, as part fo that we want to include any necessary content updates. The point of this is that it will take each file that is in the content folder and upload it to each Palo's bootstrap package. The plan is fine, it works out exactly what it needs to, but hit that error on apply. |
@benkelly89 Thanks! The issue is not due to the usage of |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Having an issue were whenever I try to use for_each with azurerm_storage_share_file. I get the below error.
I've tried on both version 2.93 and 2.99 of the provider, also on terraform version 1.1.4 and 1.1.7.
The plugin encountered an error, and failed to respond to the
plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain
more details.
Stack trace from the terraform-provider-azurerm_v2.99.0_x5 plugin:
panic: sync: negative WaitGroup counter
goroutine 145 [running]:
sync.(*WaitGroup).Add(0x675e8a0, 0xc001066080)
/opt/goenv/versions/1.17.5/src/sync/waitgroup.go:74 +0x105
sync.(*WaitGroup).Done(...)
/opt/goenv/versions/1.17.5/src/sync/waitgroup.go:99
github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/files.Client.PutFile.func1(0xb)
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/files/range_put_file.go:56 +0x2c5
created by github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/files.Client.PutFile
/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/files/range_put_file.go:40 +0x23e
Error: The terraform-provider-azurerm_v2.99.0_x5 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
##[error]Bash exited with code '1'.
Finishing: Terraform Apply
The text was updated successfully, but these errors were encountered: