Skip to content

Commit

Permalink
Merge pull request #3052 from terraform-providers/b-firehose-s3-cwl-c…
Browse files Browse the repository at this point in the history
…rash-fix

resource/aws_kinesis_firehose_delivery_stream: Prevent crash on empty CW logging opts
  • Loading branch information
radeksimko authored Jan 18, 2018
2 parents a1acd0f + bf2020c commit bf8303a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions aws/resource_aws_kinesis_firehose_delivery_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,22 @@ func flattenCloudwatchLoggingOptions(clo firehose.CloudWatchLoggingOptions) *sch
return schema.NewSet(cloudwatchLoggingOptionsHash, []interface{}{cloudwatchLoggingOptions})
}

func flattenFirehoseS3Configuration(s3 firehose.S3DestinationDescription) []map[string]interface{} {
s3Configuration := make([]map[string]interface{}, 1)
s3Configuration[0] = map[string]interface{}{
"role_arn": *s3.RoleARN,
"bucket_arn": *s3.BucketARN,
"prefix": *s3.Prefix,
"buffer_size": *s3.BufferingHints.SizeInMBs,
"buffer_interval": *s3.BufferingHints.IntervalInSeconds,
"compression_format": *s3.CompressionFormat,
"cloudwatch_logging_options": flattenCloudwatchLoggingOptions(*s3.CloudWatchLoggingOptions),
func flattenFirehoseS3Configuration(s3 firehose.S3DestinationDescription) []interface{} {
s3Configuration := map[string]interface{}{
"role_arn": *s3.RoleARN,
"bucket_arn": *s3.BucketARN,
"prefix": *s3.Prefix,
"buffer_size": *s3.BufferingHints.SizeInMBs,
"buffer_interval": *s3.BufferingHints.IntervalInSeconds,
"compression_format": *s3.CompressionFormat,
}
if s3.CloudWatchLoggingOptions != nil {
s3Configuration["cloudwatch_logging_options"] = flattenCloudwatchLoggingOptions(*s3.CloudWatchLoggingOptions)
}
if s3.EncryptionConfiguration.KMSEncryptionConfig != nil {
s3Configuration[0]["kms_key_arn"] = *s3.EncryptionConfiguration.KMSEncryptionConfig
s3Configuration["kms_key_arn"] = *s3.EncryptionConfiguration.KMSEncryptionConfig
}
return s3Configuration
return []interface{}{s3Configuration}
}

func flattenProcessingConfiguration(pc firehose.ProcessingConfiguration, roleArn string) []map[string]interface{} {
Expand Down

0 comments on commit bf8303a

Please sign in to comment.