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

r/aws_dynamodb_table - add validation for attribute types #3188

Merged
merged 2 commits into from
Jan 30, 2018

Conversation

sjauld
Copy link
Contributor

@sjauld sjauld commented Jan 30, 2018

Adds validation for DynamoDB table attribute types

$ TF_ACC=1 aws-vault exec development -- go test -v -timeout 60m -run AWSDynamoDb ./...
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSDynamoDbTable_importBasic
--- PASS: TestAccAWSDynamoDbTable_importBasic (98.88s)
=== RUN   TestAccAWSDynamoDbTable_importTags
--- PASS: TestAccAWSDynamoDbTable_importTags (96.56s)
=== RUN   TestAccAWSDynamoDbTable_importTimeToLive
--- PASS: TestAccAWSDynamoDbTable_importTimeToLive (75.67s)
=== RUN   TestAccAWSDynamoDbTable_basic
--- PASS: TestAccAWSDynamoDbTable_basic (348.35s)
=== RUN   TestAccAWSDynamoDbTable_streamSpecification
--- PASS: TestAccAWSDynamoDbTable_streamSpecification (79.78s)
=== RUN   TestAccAWSDynamoDbTable_tags
--- PASS: TestAccAWSDynamoDbTable_tags (83.97s)
=== RUN   TestAccAWSDynamoDbTable_gsiUpdateCapacity
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateCapacity (184.32s)
=== RUN   TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes (565.24s)
=== RUN   TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes (309.46s)
=== RUN   TestAccAWSDynamoDbTable_ttl
--- PASS: TestAccAWSDynamoDbTable_ttl (98.10s)
=== RUN   TestResourceAWSDynamoDbTableStreamViewType_validation
--- PASS: TestResourceAWSDynamoDbTableStreamViewType_validation (0.00s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1940.383s

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Jan 30, 2018
@radeksimko radeksimko added enhancement Requests to existing resources that expand the functionality or scope. service/dynamodb Issues and PRs that pertain to the dynamodb service. labels Jan 30, 2018
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sjauld
thanks for the PR, this looks like a useful addition.

Just one comment to address, then I'm happy to merge this! 🙂

@@ -193,6 +193,21 @@ func validateStreamViewType(v interface{}, k string) (ws []string, errors []erro
return
}

func validateDynamoAttributeType(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
validTypes := []string{"B", "N", "S"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind using constants here? i.e.

validTypes := []string{
    dynamodb.ScalarAttributeTypeB,
    dynamodb.ScalarAttributeTypeN,
    dynamodb.ScalarAttributeTypeS,
}

@radeksimko radeksimko added the waiting-response Maintainers are waiting on response from community or contributor. label Jan 30, 2018
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Jan 30, 2018
@sjauld
Copy link
Contributor Author

sjauld commented Jan 30, 2018

Done!

@radeksimko radeksimko removed the waiting-response Maintainers are waiting on response from community or contributor. label Jan 30, 2018
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@radeksimko radeksimko merged commit 5add4ac into hashicorp:master Jan 30, 2018
@bflad bflad added this to the v1.9.0 milestone Jan 30, 2018
@bflad
Copy link
Contributor

bflad commented Feb 9, 2018

This has been released in terraform-provider-aws version 1.9.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@sjauld sjauld deleted the f/validate-dynamo-key-types branch November 1, 2018 22:15
@ghost
Copy link

ghost commented Apr 2, 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 and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/dynamodb Issues and PRs that pertain to the dynamodb service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants