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

Give lambda parameters a fixed order #64

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions modules/kinesis-firehose-honeycomb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ data "aws_region" "current" {}

locals {
region = data.aws_region.current.name
default_lambda_parameters = { "BufferSizeInMBs" = 2, "BufferIntervalInSeconds" = 61 }
lambda_parameters = merge(
default_lambda_parameters = [{ "name" = "BufferSizeInMBs", "value" = 2 }, { "name" = "BufferIntervalInSeconds", "value" = 61 }]
user_lambda_parameters = [for k, v in var.lambda_processor_parameters : { "name" = k, "value" = v }]

lambda_parameters = concat(
[{ "name" = "LambdaArn", "value" = "${var.lambda_transform_arn}:$LATEST" }],
local.default_lambda_parameters,
var.lambda_processor_parameters,
{ "LambdaArn" = "${var.lambda_transform_arn}:$LATEST" },
local.user_lambda_parameters
)

}

resource "aws_kinesis_firehose_delivery_stream" "http_stream" {
Expand Down Expand Up @@ -46,11 +47,10 @@ resource "aws_kinesis_firehose_delivery_stream" "http_stream" {
type = "Lambda"

dynamic "parameters" {
// use keys() to get a stable ordering
for_each = keys(local.lambda_parameters)
for_each = local.lambda_parameters
content {
parameter_name = parameters.value
parameter_value = local.lambda_parameters[parameters.value]
parameter_name = parameters.value.name
parameter_value = parameters.value.value
}
}
}
Expand Down
Loading