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

WIP: Dynamodb gsi new resource #6688

Closed
wants to merge 4 commits into from

Conversation

ben-bourdin451
Copy link

Fixes #671

Changes proposed in this pull request:

  • Make DynamoDb GSIs as a new resource

I'm having trouble figuring out how to make this change backwards compatible, if it is indeed possible. Help or guidance in this area would greatly be appreciated. As you can see below the acceptance tests are not passing for this reason.

Another thing I would like feedback on is to change my current implementation of the GSI resource to define hash and range keys as attributes like so:

resource "aws_dynamodb_table_gsi" "gsi" {
  table_name = "${aws_dynamodb_table.table.id}"
  name = "gsi"
  hash_key {
    name = "TestGsiHashKey"
    type = "S"
  }
  write_capacity = 1
  read_capacity = 1
  projection_type = "KEYS_ONLY"
}

Instead of using attribute definitions like in the dynamo table. I'll be working on making this work while I wait for feedback.

Output from acceptance testing:

make testacc TESTARGS='-run=TestAccAWSDynamoDbTableGsi_basic' 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSDynamoDbTableGsi_basic -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSDynamoDbTableGsi_basic
=== PAUSE TestAccAWSDynamoDbTableGsi_basic
=== CONT  TestAccAWSDynamoDbTableGsi_basic
--- FAIL: TestAccAWSDynamoDbTableGsi_basic (226.01s)
	testing.go:538: Step 0 error: After applying this step and refreshing, the plan was not empty:
		
		DIFF:
		
		UPDATE: aws_dynamodb_table.table
		  attribute.#:                                            "2" => "1"
		  attribute.2744211948.name:                              "TestGsiHashKey" => ""
		  attribute.2744211948.type:                              "S" => ""
		  attribute.2990477658.name:                              "TestTableHashKey" => "TestTableHashKey"
		  attribute.2990477658.type:                              "S" => "S"
		  global_secondary_index.#:                               "1" => "0"
		  global_secondary_index.2114864726.hash_key:             "TestGsiHashKey" => ""
		  global_secondary_index.2114864726.name:                 "TerraformTestGsi-8213957448984239991" => ""
		  global_secondary_index.2114864726.non_key_attributes.#: "0" => "0"
		  global_secondary_index.2114864726.projection_type:      "KEYS_ONLY" => ""
		  global_secondary_index.2114864726.range_key:            "" => ""
		  global_secondary_index.2114864726.read_capacity:        "1" => "0"
		  global_secondary_index.2114864726.write_capacity:       "1" => "0"
		
		STATE:
		
		aws_dynamodb_table.table:
		  ID = TerraformTestTable-8830008518106655967
		  provider = provider.aws
		  arn = arn:aws:dynamodb:us-west-2:630843564847:table/TerraformTestTable-8830008518106655967
		  attribute.# = 2
		  attribute.2744211948.name = TestGsiHashKey
		  attribute.2744211948.type = S
		  attribute.2990477658.name = TestTableHashKey
		  attribute.2990477658.type = S
		  global_secondary_index.# = 1
		  global_secondary_index.2114864726.hash_key = TestGsiHashKey
		  global_secondary_index.2114864726.name = TerraformTestGsi-8213957448984239991
		  global_secondary_index.2114864726.non_key_attributes.# = 0
		  global_secondary_index.2114864726.projection_type = KEYS_ONLY
		  global_secondary_index.2114864726.range_key = 
		  global_secondary_index.2114864726.read_capacity = 1
		  global_secondary_index.2114864726.write_capacity = 1
		  hash_key = TestTableHashKey
		  local_secondary_index.# = 0
		  name = TerraformTestTable-8830008518106655967
		  point_in_time_recovery.# = 1
		  point_in_time_recovery.0.enabled = false
		  read_capacity = 1
		  server_side_encryption.# = 0
		  stream_arn = 
		  stream_enabled = false
		  stream_label = 
		  stream_view_type = 
		  tags.% = 0
		  ttl.# = 0
		  write_capacity = 1
		aws_dynamodb_table_gsi.gsi:
		  ID = TerraformTestGsi-8213957448984239991
		  provider = provider.aws
		  attribute.# = 1
		  attribute.2744211948.name = TestGsiHashKey
		  attribute.2744211948.type = S
		  hash_key = TestGsiHashKey
		  name = TerraformTestGsi-8213957448984239991
		  non_key_attributes.# = 0
		  projection_type = KEYS_ONLY
		  read_capacity = 1
		  table_name = TerraformTestTable-8830008518106655967
		  write_capacity = 1
		
		  Dependencies:
		    aws_dynamodb_table.table
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	226.097s
...

@ghost ghost added documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/dynamodb Issues and PRs that pertain to the dynamodb service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. labels Dec 3, 2018
@bflad bflad added the new-resource Introduces a new resource. label Dec 3, 2018
@aeschright aeschright requested a review from a team June 25, 2019 21:47
@teamterraform
Copy link

Notification of Recent and Upcoming Changes to Contributions

Thank you for this contribution! There have been a few recent development changes that affect this pull request. We apologize for the inconvenience, especially if there have been long review delays up until now. Please note that this is automated message from an unmonitored account. See the FAQ for additional information on the maintainer team and review prioritization.

If you are unable to complete these updates, please leave a comment for the community and maintainers so someone can potentially continue the work. The maintainers will encourage other contributors to use the existing contribution as the base for additional changes as appropriate. Otherwise, contributions that do not receive updated code or comments from the original contributor may be closed in the future so the maintainers can focus on active items.

For the most up to date information about Terraform AWS Provider development, see the Contributing Guide. Additional technical debt changes can be tracked with the technical-debt label on issues.

As part of updating a pull request with these changes, the most current unit testing and linting will run. These may report issues that were not previously reported.

Action Required: Terraform 0.12 Syntax

Reference: #8950
Reference: #14417

Version 3 and later of the Terraform AWS Provider, which all existing contributions would potentially be added, only supports Terraform 0.12 and later. Certain syntax elements of Terraform 0.11 and earlier show deprecation warnings during runs with Terraform 0.12. Documentation and test configurations, such as those including deprecated string interpolations (some_attribute = "${aws_service_thing.example.id}") should be updated to the newer syntax (some_attribute = aws_service_thing.example.id). Contribution testing will automatically fail on older syntax in the near future. Please see the referenced issues for additional information.

Action Required: Terraform Plugin SDK Version 2

Reference: #14551

The Terraform AWS Provider has been upgraded to the latest version of the Terraform Plugin SDK. Generally, most changes to contributions should only involve updating Go import paths in source code files. Please see the referenced issue for additional information.

Action Required: Removal of website/aws.erb File

Reference: #14712

Any changes to the website/aws.erb file are no longer necessary and should be removed from this contribution to prevent merge issues in the near future when the file is removed from the repository. Please see the referenced issue for additional information.

Upcoming Change of Git Branch Naming

Reference: #14292

Development environments will need their upstream Git branch updated from master to main in the near future. Please see the referenced issue for additional information and scheduling.

Upcoming Change of GitHub Organization

Reference: #14715

This repository will be migrating from https://github.com/terraform-providers/terraform-provider-aws to https://github.com/hashicorp/terraform-provider-aws. No practitioner or developer action is anticipated and most GitHub functionality will automatically redirect to the new location. Go import paths including terraform-providers can remain for now. Please see the referenced issue for additional information and scheduling.

@ewbankkit
Copy link
Contributor

Closing as stale due to inactivity.

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. service/dynamodb Issues and PRs that pertain to the dynamodb service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No method to ignore changes in DynamoDB GSI
4 participants