Skip to content

aws_dynamodb_table: local secondary index definition not sending up NonKeyAttributes #15115

Closed
@ballwood

Description

@ballwood

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.12.19

  • provider.aws v3.6.0

Affected Resource(s)

  • aws_dynamodb_table

Terraform Configuration Files

resource "aws_dynamodb_table" "agent_jobs" {
  name = "data-agents2"
  hash_key  = "agentId"
  range_key = "jobId"

  attribute {
    name = "jobId" // job id
    type = "S"
  }

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

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

  local_secondary_index {
    name               = "idx-agentId-jobStatusDate"
    projection_type    = "INCLUDE"
    range_key          = "jobStatusDate"
    non_key_attributes = ["revision"]
  }

  billing_mode     = "PAY_PER_REQUEST"
  stream_enabled   = true
  stream_view_type = "NEW_AND_OLD_IMAGES"
}

Debug Output

Request sent to aws:

{
  "AttributeDefinitions": [
    {
      "AttributeName": "jobStatusDate",
      "AttributeType": "S"
    },
    {
      "AttributeName": "agentId",
      "AttributeType": "S"
    },
    {
      "AttributeName": "jobId",
      "AttributeType": "S"
    }
  ],
  "BillingMode": "PAY_PER_REQUEST",
  "KeySchema": [
    {
      "AttributeName": "agentId",
      "KeyType": "HASH"
    },
    {
      "AttributeName": "jobId",
      "KeyType": "RANGE"
    }
  ],
  "LocalSecondaryIndexes": [
    {
      "IndexName": "idx-agentId-jobStatusDate",
      "KeySchema": [
        {
          "AttributeName": "agentId",
          "KeyType": "HASH"
        },
        {
          "AttributeName": "jobStatusDate",
          "KeyType": "RANGE"
        }
      ],
      "Projection": {
        "ProjectionType": "INCLUDE"
      }
    }
  ],
  "StreamSpecification": {
    "StreamEnabled": true,
    "StreamViewType": "NEW_AND_OLD_IMAGES"
  },
  "TableName": "data-agents2",
  "Tags": []
}

Panic Output

Expected Behavior

Should have created the dynamodb table

Actual Behavior

Did not create the table. Error: ProjectionType is INCLUDE, but NonKeyAttributes is not specified. Non-key attributes were specified in HCL

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000

Metadata

Metadata

Assignees

Labels

bugAddresses a defect in current functionality.regressionPertains to a degraded workflow resulting from an upstream patch or internal enhancement.service/dynamodbIssues and PRs that pertain to the dynamodb service.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions