-
Notifications
You must be signed in to change notification settings - Fork 24
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
TERRA-74 ⁃ Dynamic blocks not working with astra_table resource? #160
Comments
@bigjew92 Thanks for reporting the issue. I'll take a look today and get back to you. |
@bigjew92 Sorry for the delay, I've been distracted on some other items. I'll try to get to this in the next day or two. |
@bigjew92 I don't think you can use an dynamic block in this situation. |
Gotcha. Thanks @emerkle826. My goal was to be able to pass these to a module, since there can be N number of Doesn't sound like that's possible with the way it is currently implemented, but would definitely be desired. |
@bigjew92 resource "astra_table" "table" {
table = var.table
keyspace = var.keyspace
database_id = var.database_id
region = var.region
clustering_columns = var.clustering_columns
partition_keys = var.partition_keys
column_definitions = [
dynamic "column_defs" {
for_each = var.column_definitions
content {
name = column_defs.value.name
static = column_defs.value.static
typeDefinition = column_defs.value.typeDefinition
}]
}
} But I have not tried it. Each column definition is a map of string values, which might work like above, but again I haven't tested it. I'm traveling at the moment, so I can try it when I get where I'm going if you haven't by then |
If it doesn't work, I'll try to see if I can come up with something that is allowed and gets you closer to what you need. |
Thanks for the suggestion @emerkle826. We tried that and it wasn't working. The dynamic block constructs repeatable blocks within a resource. So this would make multiple Would appreciate any ideas on how to get to the goal. Will keep trying things and let you know if we come up with something as well. |
Hi @emerkle826, I tried another way: `resource "astra_table" "table" { for_each = var.column_definitions }` And this is the error that I am getting: `Error: Plugin did not respond Stack trace from the terraform-provider-astra_v2.1.4 plugin: panic: runtime error: invalid memory address or nil pointer dereference goroutine 15 [running]: Error: The terraform-provider-astra_v2.1.4 plugin crashed! This is always indicative of a bug within the plugin. It would be immensely Do you know what might happen here? |
@milalima Sorry I haven't replied in a while. I'm taking a look now |
@bigjew92 @milalima Apologies for the delay. I might have a solution, though it really only moves the column definitions around. But here goes. In a local module called "testing", you could define a
Along side that file, declare an
Now, in the main module, you can pull in the "testing" module and reference the
I'm not sure if this really addresses the desire, as it doesn't use any Terraform loops ( Let me know if this is sufficient. Outside of this solution, I'm afraid the resource structure for a |
@milalima To address you question, I'm not sure what is going on from the snippet you provided. However, if something like below would work:
It would create a table for each column_definition in |
Thanks @emerkle826. I will take a look at the first option of defining it as a variable within the module like you've done. It might just be easier to keep it as a flat resource for now/going forward. The goal was to hopefully make it easier for developers that we support to be able to call the module, slightly easier than just creating resources. For now, I think we are okay. If in the future the table resource changes, that would be huge for our use case. If that can be submitted as a feature request, would really appreciate that. Thanks again for all your help! |
Hi there,
Please provide the following details with your issue report.
Terraform Version
Terraform
v1.1.9
Provider
v2.1.4
Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Debug Output
Expected Behavior
I am expecting to be able to use dynamic blocks to add multiple
column_definitions
to each of my tables.Actual Behavior
The plan fails when trying to use dynamic blocks.
References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
┆Issue is synchronized with this Jira Task by Unito
┆friendlyId: TERRA-74
┆priority: Major
The text was updated successfully, but these errors were encountered: