Skip to content

TERRA-74 ⁃ Dynamic blocks not working with astra_table resource? #160

@bigjew92

Description

@bigjew92

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:

  • astra_table

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

module "testing" {
  source = "../"

  table              = "test"
  keyspace           = "test"
  database_id        = "12345"
  region             = "us-east-1"
  clustering_columns = "a:b"
  partition_keys     = "c:d"

  column_definitions = [
    { name = "astra-dev", static = false, typeDefinition= "text" },
  ]
}

#module resource
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
  dynamic "column_definitions" {
    for_each = var.column_definitions
    content {
      name           = column_definitions.value.name
      static         = column_definitions.value.static
      typeDefinition = column_definitions.value.typeDefinition
    }
  }
}

Debug Output

terraform plan
╷
│ Error: Missing required argument
│ 
│   on ../main.tf line 10, in resource "astra_table" "table":
│   10: resource "astra_table" "table" {
│ 
│ The argument "column_definitions" is required, but no definition was found.
╵
╷
│ Error: Unsupported block type
│ 
│   on ../main.tf line 17, in resource "astra_table" "table":
│   17:   dynamic "column_definitions" {
│ 
│ Blocks of type "column_definitions" are not expected here.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions