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: Allow disabling stream w/ empty view type #3197

Merged
merged 1 commit into from
Jan 31, 2018

Conversation

radeksimko
Copy link
Member

Fixes #1134

Despite stream_view_type being optional the validation is still being triggered which makes it impossible to parametrise the stream spec as described in #1134

Test results

=== RUN   TestAccAWSDynamoDbTable_streamSpecification
--- PASS: TestAccAWSDynamoDbTable_streamSpecification (92.66s)

@radeksimko radeksimko added the bug Addresses a defect in current functionality. label Jan 30, 2018
@radeksimko radeksimko requested a review from bflad January 30, 2018 14:15
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Jan 30, 2018
@radeksimko radeksimko added the service/dynamodb Issues and PRs that pertain to the dynamodb service. label Jan 30, 2018
return fmt.Sprintf(`
resource "aws_dynamodb_table" "basic-dynamodb-table" {
name = "TerraformTestStreamTable-%d"
read_capacity = 10
write_capacity = 20
hash_key = "TestTableHashKey"
range_key = "TestTableRangeKey"
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for making the configuration more relevant to what we're trying to test here 👍

@bflad
Copy link
Contributor

bflad commented Jan 30, 2018

I understand where this is change coming from and the Terraform schema helpers don't necessarily make this easy, but it now allows this incorrect configuration to passthrough to the apply stage and fail:

stream_enabled   = true
stream_view_type = ""

e.g. testAccAWSDynamoDbConfigStreamSpecification(true, ""),

make testacc TEST=./aws TESTARGS='-run=TestAccAWSDynamoDbTable_streamSpecification'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSDynamoDbTable_streamSpecification -timeout 120m
=== RUN   TestAccAWSDynamoDbTable_streamSpecification
--- FAIL: TestAccAWSDynamoDbTable_streamSpecification (4.47s)
	testing.go:513: Step 0 error: Error applying: 1 error(s) occurred:

		* aws_dynamodb_table.basic-dynamodb-table: 1 error(s) occurred:

		* aws_dynamodb_table.basic-dynamodb-table: ValidationException: 1 validation error detected: Value '' at 'streamSpecification.streamViewType' failed to satisfy constraint: Member must satisfy enum value set: [OLD_IMAGE, KEYS_ONLY, NEW_AND_OLD_IMAGES, NEW_IMAGE]
			status code: 400, request id: BU4C7KSK4LOBT764E77I8FEOCRVV4KQNSO5AEMVJF66Q9ASUAAJG
FAIL
exit status 1
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	4.517s
make: *** [testacc] Error 1

@radeksimko radeksimko force-pushed the b-dynamodb-table-stream-fix branch from d7cba3f to b52767a Compare January 31, 2018 07:47
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Jan 31, 2018
@radeksimko radeksimko force-pushed the b-dynamodb-table-stream-fix branch from b52767a to cd47170 Compare January 31, 2018 08:02
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Jan 31, 2018
@radeksimko radeksimko force-pushed the b-dynamodb-table-stream-fix branch from cd47170 to b77f4aa Compare January 31, 2018 10:01
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Jan 31, 2018
@radeksimko radeksimko force-pushed the b-dynamodb-table-stream-fix branch from b77f4aa to 83dcb38 Compare January 31, 2018 10:21
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Jan 31, 2018
@radeksimko
Copy link
Member Author

@bflad Added validation as discussed 😉

I also removed Computed from stream_enabled as it doesn't seem to be necessary there at all. I was tempted to do the same for stream_view_type and set Default instead, but we don't have any helper schemas to help us differentiate between defaults and undefined yet, so I left it as is.

All DynamoDB acceptance tests are still passing.

@radeksimko radeksimko requested a review from bflad January 31, 2018 10:25
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM!

@radeksimko radeksimko merged commit 571bdbe into master Jan 31, 2018
@radeksimko radeksimko deleted the b-dynamodb-table-stream-fix branch January 31, 2018 14:38
@bflad bflad added this to the v1.9.0 milestone Feb 9, 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.

@ghost
Copy link

ghost commented Apr 8, 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 8, 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. 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.

aws_dynamo_db_table throws validation error when disabling stream where stream_view_type is also specified
2 participants