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_iot_topic_rule: Fix optional attributes #7471

Merged
merged 4 commits into from
Feb 13, 2019

Conversation

nywilken
Copy link
Contributor

@nywilken nywilken commented Feb 7, 2019

Terraform requires arguments that are optional when creating aws_iot_topic_rule

Logged POST request before update

$ TF_LOG_PATH=log.txt TF_LOG=debug TF_ACC=1 go test ./aws -v -timeout 120m -parallel 10 -run=TestAccAWSIoTTopicRule_basic                                     
                                                                                                                                                              
2019/02/08 12:48:15 [DEBUG] [aws-sdk-go] DEBUG: Request iot/CreateTopicRule Details:                                                                          
---[ REQUEST POST-SIGN ]-----------------------------                                                                                                         POST /rules/test_rule_nlzsp HTTP/1.1
[...]
{"actions":[{"dynamoDB":{"hashKeyField":"hash_key_field","hashKeyValue":"hash_key_value","payloadField":"payload_field","rangeKeyField":"range_key_field","rangeKeyValue":"range_key_value","roleArn":"arn:aws:iam::187416307283:role/test_role_nlzsp","tableName":"table_name"}}],"awsIotSqlVersion":"2015-10-08","description":"Example rule","ruleDisabled":false,"sql":"SELECT * FROM 'topic/test'"} 
-----------------------------------------------------
2019/02/08 12:48:15 [DEBUG] [aws-sdk-go] DEBUG: Response iam/CreatePolicy Details: 
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK^M                                                                                                                                             

Logged POST request after update

$TF_LOG_PATH=log.txt TF_LOG=debug TF_ACC=1 go test ./aws -v -timeout 120m -parallel 10 -run=TestAccAWSIoTTopicRule_dynamodb 
2019/02/08 12:54:28 [DEBUG] [aws-sdk-go] DEBUG: Request iot/CreateTopicRule Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST /rules/test_rule_6qq07 HTTP/1.1
[...]
{"actions":[{"dynamoDB":{"hashKeyField":"hash_key_field","hashKeyValue":"hash_key_value","payloadField":"payload_field","roleArn":"arn:aws:iam::187416307283:role/test_role_6qq07","tableName":"table_name"}}],"awsIotSqlVersion":"2015-10-08","description":"Example rule","ruleDisabled":false,"sql":"SELECT * FROM 'topic/test'"}
-----------------------------------------------------
2019/02/08 12:54:28 [DEBUG] [aws-sdk-go] DEBUG: Response iam/GetPolicyVersion Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK

closes #6195

@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/iot Issues and PRs that pertain to the iot service. labels Feb 7, 2019
@nywilken nywilken requested a review from a team February 7, 2019 19:57
@bflad bflad added bug Addresses a defect in current functionality. waiting-response Maintainers are waiting on response from community or contributor. labels Feb 8, 2019
@ghost ghost added size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/XS Managed by automation to categorize the size of a PR. labels Feb 8, 2019
@nywilken
Copy link
Contributor Author

nywilken commented Feb 8, 2019

@bflad I made a few additional updates along with the added test case. Please let me know if there is anything that I may have missed.

@nywilken nywilken added waiting-response Maintainers are waiting on response from community or contributor. and removed waiting-response Maintainers are waiting on response from community or contributor. labels Feb 8, 2019
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.

Getting very close! This looks fine, I just want to be sure we're appropriately covering both configured and unconfigured scenarios to prevent regressions in the future.

aws/resource_aws_iot_topic_rule_test.go Show resolved Hide resolved
aws/resource_aws_iot_topic_rule_test.go Show resolved Hide resolved
aws/structure.go Show resolved Hide resolved
* Add an acceptance test for asserting a successful dynamodb request

* Move optional attributes out of the default API payload; They are now
only added if specified in the terraform configuration for dynamodb.
@nywilken nywilken force-pushed the b-aws_iot_topic_rule-dynamodb-attributes branch from b7d6c0e to 71133dd Compare February 12, 2019 04:25
* Add aws.StringValue to protect against nil pointers
* Update variables to follow modern provider naming conventions
* Add initial capacity size for items slice
@nywilken nywilken force-pushed the b-aws_iot_topic_rule-dynamodb-attributes branch from 71133dd to a966eb3 Compare February 12, 2019 04:37
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, thanks @nywilken! 🚀

--- PASS: TestAccAWSIoTTopicRule_cloudwatchmetric (10.73s)
--- PASS: TestAccAWSIoTTopicRule_kinesis (10.85s)
--- PASS: TestAccAWSIoTTopicRule_basic (10.95s)
--- PASS: TestAccAWSIoTTopicRule_lambda (11.02s)
--- PASS: TestAccAWSIoTTopicRule_firehose (11.12s)
--- PASS: TestAccAWSIoTTopicRule_republish (11.06s)
--- PASS: TestAccAWSIoTTopicRule_sqs (11.14s)
--- PASS: TestAccAWSIoTTopicRule_cloudwatchalarm (11.74s)
--- PASS: TestAccAWSIoTTopicRule_sns (11.97s)
--- PASS: TestAccAWSIoTTopicRule_importbasic (12.09s)
--- PASS: TestAccAWSIoTTopicRule_elasticsearch (12.25s)
--- PASS: TestAccAWSIoTTopicRule_s3 (12.65s)
--- PASS: TestAccAWSIoTTopicRule_dynamodb (15.98s)
--- PASS: TestAccAWSIoTTopicRule_firehose_separator (16.02s)

@bflad bflad added this to the v1.59.0 milestone Feb 13, 2019
@bflad bflad merged commit d59734f into master Feb 13, 2019
@bflad bflad deleted the b-aws_iot_topic_rule-dynamodb-attributes branch February 13, 2019 20:15
bflad added a commit that referenced this pull request Feb 13, 2019
@bflad
Copy link
Contributor

bflad commented Feb 14, 2019

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

@ghost
Copy link

ghost commented Mar 31, 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 Mar 31, 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/iot Issues and PRs that pertain to the iot service. size/M 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.

Terraform requires arguments that are optional when creating aws_iot_topic_rule
2 participants