Skip to content

Unable to use underscore in tables names #139

Open
@nadge

Description

@nadge

Describe the Bug

I am currently working on recreating existing infrastructure using terraform. I am using this package to recreate some Dynamo Tables but unfortunately they need to retain their existing name which contains underscores.

when I set the name with underscores in terraform these seem to be removed when applied and the result is applied without underscores.

Tested with default AWS module and this does not happen

Expected Behavior

When using underscores in name of dynamo table the table is created using these underscores

Steps to Reproduce

create terraform module

module "dynamodb_table" {
  source                        = "cloudposse/dynamodb/aws"
  name                          = "test_underscore"
  hash_key                      = "test_id"
  enable_autoscaler             = false
  enable_point_in_time_recovery = false
}

See plan has name without underscores:

+ resource "aws_dynamodb_table" "default" {
      + arn                         = (known after apply)
      + billing_mode                = "PROVISIONED"
      + deletion_protection_enabled = false
      + hash_key                    = "test_id"
      + id                          = (known after apply)
      + name                        = "testunderscore"
      + read_capacity               = 5
      + stream_arn                  = (known after apply)
      + stream_enabled              = false
      + stream_label                = (known after apply)
      + stream_view_type            = (known after apply)
      + tags                        = {
          + "Name" = "testunderscore"
        }
      + tags_all                    = {
          + "Name" = "testunderscore"
        }
      + write_capacity              = 5

      + attribute {
          + name = "test_id"
          + type = "S"
        }

      + point_in_time_recovery {
          + enabled = false
        }

      + server_side_encryption {
          + enabled     = true
          + kms_key_arn = (known after apply)
        }

      + ttl {
          + attribute_name = "Expires"
          + enabled        = true
        }
    }

Finally when applied see table has underscores removed:
image

Screenshots

No response

Environment

Mac OS (M3)
terraform 1.7.5

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions