Skip to content
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

resource/aws_dynamodb_table: Don't fall back to primary hash key in LSI #3176

Closed
radeksimko opened this issue Jan 29, 2018 · 4 comments
Closed
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@radeksimko
Copy link
Member

Terraform Version

1.8.0

Terraform Configuration Files

The DynamoDB table resource is a bit (confusingly) magical in the sense that it automatically falls back to hash_key if there was no hash_key set in local_secondary_index.*.hash_key.

resource "aws_dynamodb_table" "basic-dynamodb-table" {
  name = "test"
  read_capacity = 10
  write_capacity = 20
  hash_key = "TestTableHashKey"
  range_key = "TestTableRangeKey"

  attribute {
    name = "TestTableHashKey"
    type = "S"
  }

  attribute {
    name = "TestTableRangeKey"
    type = "S"
  }

  attribute {
    name = "TestLSIRangeKey"
    type = "N"
  }

  attribute {
    name = "TestGSIRangeKey"
    type = "S"
  }

  local_secondary_index {
    name = "TestTableLSI"
    range_key = "TestLSIRangeKey"
    # Missing hash_key here
    projection_type = "ALL"
  }

  global_secondary_index {
    name = "InitialTestTableGSI"
    hash_key = "TestTableHashKey"
    range_key = "TestGSIRangeKey"
    write_capacity = 10
    read_capacity = 10
    projection_type = "KEYS_ONLY"
  }
}

This is a reminder to revisit the decision and align the implementation more with the API - i.e. just let users be explicit and let API error out if they don't provide local_secondary_index.*.hash_key.

References

@radeksimko radeksimko added bug Addresses a defect in current functionality. breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. service/dynamodb Issues and PRs that pertain to the dynamodb service. labels Jan 29, 2018
@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Mar 28, 2020
@wedneyyuri
Copy link

Interesting, looks like it's invalid.

local_secondary_index {
    name            = "ParentID-index"
    hash_key        = "ParentID" // <--
    range_key       = "CategoryID"
    projection_type = "ALL"
}

Error: An argument named "hash_key" is not expected here.

@ghost ghost removed the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Apr 23, 2020
@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Apr 14, 2022
@github-actions
Copy link

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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

2 participants