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

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

Closed
ballwood opened this issue Sep 11, 2020 · 8 comments · Fixed by #15195
Closed
Assignees
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/dynamodb Issues and PRs that pertain to the dynamodb service.
Milestone

Comments

@ballwood
Copy link

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
@ghost ghost added the service/dynamodb Issues and PRs that pertain to the dynamodb service. label Sep 11, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 11, 2020
@ballwood
Copy link
Author

Investigated and was broken due to #15115 as reverting to 3.4.0 works fine

@anGie44 anGie44 added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 14, 2020
@anGie44
Copy link
Contributor

anGie44 commented Sep 14, 2020

Hi @ballwood, thank you for creating this issue and apologies you came across this regression! I believe it's related to changes made in #9988 , such that I removed the logic to expand that list of non_key_attributes, but it's inplace for expanding Terraform Plugin SDK set types, explaining why the request no longer contains that field anymore.

Relevant code that needs to be added back:
https://github.com/terraform-providers/terraform-provider-aws/pull/9988/files#diff-609906472a0a9de4d53f3baeae057583L4211-L4212

@anGie44
Copy link
Contributor

anGie44 commented Sep 18, 2020

Hi @ballwood , the fix for this has been merged and will release with v3.8.0 of the Terraform AWS Provider, expected out next Thursday 👍

anGie44 added a commit that referenced this issue Sep 18, 2020
@ballwood
Copy link
Author

ballwood commented Sep 19, 2020 via email

@omkar-k3
Copy link

omkar-k3 commented Sep 20, 2020

Hi @anGie44
I am also facing same issue. I tried to create LSI from console and the same logic has been put into my terraform code but it throws an error 'Projection type is INCUDE but NonKeyAttributes is not specified'
Is fix coming in next couple of days?.

@anGie44
Copy link
Contributor

anGie44 commented Sep 21, 2020

Hi @omkar-k3 , thanks for commenting here. Yes, the fix has been merged and will likely be released this Thursday (v3.8.0 of the AWS Provider).

@ghost
Copy link

ghost commented Sep 24, 2020

This has been released in version 3.8.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Oct 19, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/dynamodb Issues and PRs that pertain to the dynamodb service.
Projects
None yet
3 participants