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_kinesis_firehose_delivery_stream: Prevent panic with empty processing_configuration configuration block #12613

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Apr 1, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #12600

Release note for CHANGELOG:

* resource/aws_kinesis_firehose_delivery_stream: Prevent panic with empty `processing_configuration` configuration block

Previously:

=== CONT  TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ProcessingConfiguration_Empty
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 118 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.extractProcessingConfiguration(0xc00184d260, 0xc00184d260)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:1740 +0x2c8
github.com/terraform-providers/terraform-provider-aws/aws.createExtendedS3Config(0xc00046aaf0, 0x6e20c0a)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:1447 +0x87d
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsKinesisFirehoseDeliveryStreamCreate(0xc00046aaf0, 0x62e1d20, 0xc0006cc500, 0x2, 0xb612ec0)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:2119 +0xee2
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000a7c400, 0xc00018e230, 0xc0008dc980, 0x62e1d20, 0xc0006cc500, 0x6167b01, 0xc001428fa8, 0xc001690d50)
  /Users/bflad/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.8.0/helper/schema/resource.go:305 +0x365

Output from acceptance testing:

--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_basic (133.73s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ElasticsearchConfigUpdates (827.20s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update (125.27s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Enabled (147.94s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_HiveJsonSerDe_Empty (125.16s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OpenXJsonSerDe_Empty (117.24s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OrcSerDe_Empty (124.51s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_ParquetSerDe_Empty (90.80s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update (110.44s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ErrorOutputPrefix (116.60s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ExternalUpdate (133.58s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ProcessingConfiguration_Empty (101.05s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3basic (140.86s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3KmsKeyArn (138.74s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3Updates (192.36s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_missingProcessingConfiguration (101.08s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_RedshiftConfigUpdates (419.73s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basic (98.32s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithSSE (231.02s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithTags (153.05s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3ConfigUpdates (199.63s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3KinesisStreamSource (105.65s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3WithCloudwatchLogging (118.33s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_SplunkConfigUpdates (159.89s)

…ty `processing_configuration` configuration block

Reference: #12600

Previously:

```
=== CONT  TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ProcessingConfiguration_Empty
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 118 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.extractProcessingConfiguration(0xc00184d260, 0xc00184d260)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:1740 +0x2c8
github.com/terraform-providers/terraform-provider-aws/aws.createExtendedS3Config(0xc00046aaf0, 0x6e20c0a)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:1447 +0x87d
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsKinesisFirehoseDeliveryStreamCreate(0xc00046aaf0, 0x62e1d20, 0xc0006cc500, 0x2, 0xb612ec0)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:2119 +0xee2
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000a7c400, 0xc00018e230, 0xc0008dc980, 0x62e1d20, 0xc0006cc500, 0x6167b01, 0xc001428fa8, 0xc001690d50)
  /Users/bflad/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.8.0/helper/schema/resource.go:305 +0x365
```

Output from acceptance testing:

```
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_basic (133.73s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ElasticsearchConfigUpdates (827.20s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update (125.27s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Enabled (147.94s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_HiveJsonSerDe_Empty (125.16s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OpenXJsonSerDe_Empty (117.24s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OrcSerDe_Empty (124.51s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_ParquetSerDe_Empty (90.80s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update (110.44s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ErrorOutputPrefix (116.60s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ExternalUpdate (133.58s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ProcessingConfiguration_Empty (101.05s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3basic (140.86s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3KmsKeyArn (138.74s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3Updates (192.36s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_missingProcessingConfiguration (101.08s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_RedshiftConfigUpdates (419.73s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basic (98.32s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithSSE (231.02s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithTags (153.05s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3ConfigUpdates (199.63s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3KinesisStreamSource (105.65s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3WithCloudwatchLogging (118.33s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_SplunkConfigUpdates (159.89s)
```
@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Apr 1, 2020
@bflad bflad requested a review from a team April 1, 2020 15:01
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/S Managed by automation to categorize the size of a PR. service/firehose Issues and PRs that pertain to the firehose service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 1, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Apr 1, 2020
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3KinesisStreamSource (92.96s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3WithCloudwatchLogging (109.09s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ExternalUpdate (122.40s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ErrorOutputPrefix (128.19s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OrcSerDe_Empty (128.88s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_HiveJsonSerDe_Empty (130.07s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update (130.06s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_basic (131.36s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3basic (136.63s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update (137.22s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basic (137.52s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ProcessingConfiguration_Empty (146.68s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3Updates (148.49s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Enabled (153.13s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithTags (154.27s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OpenXJsonSerDe_Empty (158.26s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_ParquetSerDe_Empty (159.73s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3KmsKeyArn (165.69s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3ConfigUpdates (193.26s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_missingProcessingConfiguration (81.26s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_SplunkConfigUpdates (120.08s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithSSE (230.39s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_RedshiftConfigUpdates (514.25s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ElasticsearchConfigUpdates (810.27s)

@@ -1995,6 +2024,24 @@ resource "aws_kinesis_firehose_delivery_stream" "test" {
`, rName, errorOutputPrefix)
}

func testAccKinesisFirehoseDeliveryStreamConfig_ExtendedS3_ProcessingConfiguration_Empty(rName string, rInt int) string {
return fmt.Sprintf(testAccKinesisFirehoseDeliveryStreamBaseConfig, rInt, rInt, rInt) + fmt.Sprintf(`
Copy link
Contributor

Choose a reason for hiding this comment

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

fmt.Sprintf(testAccKinesisFirehoseDeliveryStreamBaseConfig, rInt, rInt, rInt) is concatenated with a lot of configurations in this test suite. testAccKinesisFirehoseDeliveryStreamBaseConfig should probably be a function rather than a constant string.

Since the base config is used many places, you could define a composeKinesisFirehoseConfig() which predefines the base config and accepts the new configuration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, this whole test file needs refactoring, but that effort seems unrelated to fixing the panic. 🙁

@bflad bflad added this to the v2.60.0 milestone Apr 28, 2020
@bflad bflad merged commit 4e39406 into master Apr 28, 2020
@bflad bflad deleted the b-aws_kinesis_firehose_delivery_stream-processing_configuration-panic branch April 28, 2020 18:40
bflad added a commit that referenced this pull request Apr 28, 2020
@ghost
Copy link

ghost commented May 1, 2020

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

adamdecaf pushed a commit to adamdecaf/terraform-provider-aws that referenced this pull request May 28, 2020
…ty `processing_configuration` configuration block (hashicorp#12613)

Reference: hashicorp#12600

Previously:

```
=== CONT  TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ProcessingConfiguration_Empty
panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 118 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.extractProcessingConfiguration(0xc00184d260, 0xc00184d260)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:1740 +0x2c8
github.com/terraform-providers/terraform-provider-aws/aws.createExtendedS3Config(0xc00046aaf0, 0x6e20c0a)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:1447 +0x87d
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsKinesisFirehoseDeliveryStreamCreate(0xc00046aaf0, 0x62e1d20, 0xc0006cc500, 0x2, 0xb612ec0)
  /Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_kinesis_firehose_delivery_stream.go:2119 +0xee2
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000a7c400, 0xc00018e230, 0xc0008dc980, 0x62e1d20, 0xc0006cc500, 0x6167b01, 0xc001428fa8, 0xc001690d50)
  /Users/bflad/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.8.0/helper/schema/resource.go:305 +0x365
```

Output from acceptance testing:

```
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_basic (133.73s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ElasticsearchConfigUpdates (827.20s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update (125.27s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Enabled (147.94s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_HiveJsonSerDe_Empty (125.16s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OpenXJsonSerDe_Empty (117.24s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OrcSerDe_Empty (124.51s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_ParquetSerDe_Empty (90.80s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update (110.44s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ErrorOutputPrefix (116.60s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ExternalUpdate (133.58s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ProcessingConfiguration_Empty (101.05s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3basic (140.86s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3KmsKeyArn (138.74s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3Updates (192.36s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_missingProcessingConfiguration (101.08s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_RedshiftConfigUpdates (419.73s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basic (98.32s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithSSE (231.02s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithTags (153.05s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3ConfigUpdates (199.63s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3KinesisStreamSource (105.65s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3WithCloudwatchLogging (118.33s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_SplunkConfigUpdates (159.89s)
```
@ghost
Copy link

ghost commented May 29, 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 May 29, 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. crash Results from or addresses a Terraform crash or kernel panic. service/firehose Issues and PRs that pertain to the firehose service. size/S 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.

Creating a kinesis firehose delivery stream fails with an rpc error
2 participants