-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add 'Seperator' property to AWS IoT Firehose Rule #5734
Add 'Seperator' property to AWS IoT Firehose Rule #5734
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this @bdoepf! 🚀 This was off to a good start and just needed some extra bits to finish up appropriately (since dealing with whitespace characters is a pain 😄 ), which I took care of in a followup commit so we can get this released today.
While verifying this change, I found it would generate a panic for any configuration that was missing the new separator
argument by removing the separator argument from the existing test configuration. This is fixed now.
So looks good now (with new testing):
$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSIoTTopicRule_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSIoTTopicRule_ -timeout 120m
=== RUN TestAccAWSIoTTopicRule_importbasic
--- PASS: TestAccAWSIoTTopicRule_importbasic (10.57s)
=== RUN TestAccAWSIoTTopicRule_basic
--- PASS: TestAccAWSIoTTopicRule_basic (8.47s)
=== RUN TestAccAWSIoTTopicRule_cloudwatchalarm
--- PASS: TestAccAWSIoTTopicRule_cloudwatchalarm (9.02s)
=== RUN TestAccAWSIoTTopicRule_cloudwatchmetric
--- PASS: TestAccAWSIoTTopicRule_cloudwatchmetric (9.31s)
=== RUN TestAccAWSIoTTopicRule_elasticsearch
--- PASS: TestAccAWSIoTTopicRule_elasticsearch (9.43s)
=== RUN TestAccAWSIoTTopicRule_firehose
--- PASS: TestAccAWSIoTTopicRule_firehose (9.35s)
=== RUN TestAccAWSIoTTopicRule_firehose_separator
--- PASS: TestAccAWSIoTTopicRule_firehose_separator (14.01s)
=== RUN TestAccAWSIoTTopicRule_kinesis
--- PASS: TestAccAWSIoTTopicRule_kinesis (9.69s)
=== RUN TestAccAWSIoTTopicRule_lambda
--- PASS: TestAccAWSIoTTopicRule_lambda (8.47s)
=== RUN TestAccAWSIoTTopicRule_republish
--- PASS: TestAccAWSIoTTopicRule_republish (8.10s)
=== RUN TestAccAWSIoTTopicRule_s3
--- PASS: TestAccAWSIoTTopicRule_s3 (9.82s)
=== RUN TestAccAWSIoTTopicRule_sns
--- PASS: TestAccAWSIoTTopicRule_sns (8.18s)
=== RUN TestAccAWSIoTTopicRule_sqs
--- PASS: TestAccAWSIoTTopicRule_sqs (8.20s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 123.374s
return nil, nil | ||
} | ||
|
||
return nil, []error{fmt.Errorf("Separator must be one of ',' (comma), '\t' (tab) '\n' (newline) or '\r\n' (Windows newline)")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When printing this error, it is returning the whitespace and not the intended characters:
aws_iot_topic_rule.rule: Separator must be one of ',' (comma), ' ' (tab) '
' (newline) or '
' (Windows newline)
They need to be escaped appropriately. 👍
@@ -2754,6 +2754,7 @@ func flattenIoTRuleFirehoseActions(actions []*iot.Action) []map[string]interface | |||
if v != nil { | |||
result["role_arn"] = *v.RoleArn | |||
result["delivery_stream_name"] = *v.DeliveryStreamName | |||
result["separator"] = *v.Separator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API will omit this value in the response if parameter is not provided in the configuration and cause a panic:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2e9cb09]
goroutine 406 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.flattenIoTRuleFirehoseActions(0xc0000c9058, 0x1, 0x1, 0x379df40, 0xc000669520, 0x0)
/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/structure.go:2815 +0x1e9
We should prefer to use the AWS SDK provided functions to dereference pointers instead, e.g. result["separator"] = aws.StringValue(v.Separator)
* Prevent panic with omitted firehose separator in API response * Escape whitespace characters in firehose separator ValidateFunc error message * Add separate test for firehose separator ``` $ make testacc TEST=./aws TESTARGS='-run=TestAccAWSIoTTopicRule_' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -run=TestAccAWSIoTTopicRule_ -timeout 120m === RUN TestAccAWSIoTTopicRule_importbasic --- PASS: TestAccAWSIoTTopicRule_importbasic (10.57s) === RUN TestAccAWSIoTTopicRule_basic --- PASS: TestAccAWSIoTTopicRule_basic (8.47s) === RUN TestAccAWSIoTTopicRule_cloudwatchalarm --- PASS: TestAccAWSIoTTopicRule_cloudwatchalarm (9.02s) === RUN TestAccAWSIoTTopicRule_cloudwatchmetric --- PASS: TestAccAWSIoTTopicRule_cloudwatchmetric (9.31s) === RUN TestAccAWSIoTTopicRule_elasticsearch --- PASS: TestAccAWSIoTTopicRule_elasticsearch (9.43s) === RUN TestAccAWSIoTTopicRule_firehose --- PASS: TestAccAWSIoTTopicRule_firehose (9.35s) === RUN TestAccAWSIoTTopicRule_firehose_separator --- PASS: TestAccAWSIoTTopicRule_firehose_separator (14.01s) === RUN TestAccAWSIoTTopicRule_kinesis --- PASS: TestAccAWSIoTTopicRule_kinesis (9.69s) === RUN TestAccAWSIoTTopicRule_lambda --- PASS: TestAccAWSIoTTopicRule_lambda (8.47s) === RUN TestAccAWSIoTTopicRule_republish --- PASS: TestAccAWSIoTTopicRule_republish (8.10s) === RUN TestAccAWSIoTTopicRule_s3 --- PASS: TestAccAWSIoTTopicRule_s3 (9.82s) === RUN TestAccAWSIoTTopicRule_sns --- PASS: TestAccAWSIoTTopicRule_sns (8.18s) === RUN TestAccAWSIoTTopicRule_sqs --- PASS: TestAccAWSIoTTopicRule_sqs (8.20s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 123.374s ```
This has been released in version 1.36.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
@bflad Thanks for your detailed review and fixing the open issues 👍 :-) |
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! |
Fixes #5733
Changes proposed in this pull request:
Output from acceptance testing: