Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ locals {
x86_64 = "",
arm64 = "-ARM"
}
fips_suffix = var.datadog_enable_fips ? "-FIPS" : ""
runtime_base = regex("[a-z]+", var.runtime)
runtime_base_environment_variable_map = {
dotnet = {
Expand Down Expand Up @@ -55,7 +56,7 @@ locals {

locals {
datadog_extension_layer_arn = "${local.datadog_layer_name_base}:Datadog-Extension${local.datadog_extension_layer_suffix}:${var.datadog_extension_layer_version}"
datadog_extension_layer_suffix = local.datadog_layer_suffix
datadog_extension_layer_suffix = "${local.datadog_layer_suffix}${local.fips_suffix}"
Copy link
Contributor

Choose a reason for hiding this comment

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

what are we using the existing "datadog_layer_suffix" bit for? can we reuse it for fips?

Copy link
Author

@ShepleySound ShepleySound Jun 18, 2025

Choose a reason for hiding this comment

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

Looks like it's a lookup on the architectures variable and determines the suffix for both the layer for the Datadog Lambda Library and the layer for the Lambda Extension.

From what I've gathered from the docs, the Extension has FIPS-compatible layers, but the Lambda Library does not. So the suffixes are related, but do actually need to be different in this case.


datadog_lambda_layer_arn = "${local.datadog_layer_name_base}:${local.datadog_lambda_layer_runtime}${local.datadog_lambda_layer_suffix}:${local.datadog_lambda_layer_version}"
datadog_lambda_layer_suffix = contains(["java", "nodejs"], local.runtime_base) ? "" : local.datadog_layer_suffix # java and nodejs don't have separate layers for ARM
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ variable "datadog_python_layer_version" {
default = 106
}

variable "datadog_enable_fips" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you rename it as datadog_is_fips_enabled to be consistent with Serverless Plugin?
DataDog/serverless-plugin-datadog#598 (comment)

Copy link
Author

Choose a reason for hiding this comment

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

Done! I see that there was also a change in that PR to make FIPS the default when in GovCloud. Would you prefer that behavior here as well? I'd just need to move that logic into the locals block.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please go ahead. Thanks for helping with this change!

Copy link
Author

Choose a reason for hiding this comment

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

Apologies for the late response! So in the serverless plugin site is a proper parameter, whereas here it's just a DD_SITE entry in an environment_variables map. That plus the fact that TF doesn't support conditional variable defaults (iirc) might make the implementation a bit sloppy.

I went ahead and gave it a go, but I'm also happy to revert it if it's a little too magical. Changing the default behavior might also be considered a breaking change.

description = "Enable FIPS compliant extension layers"
type = bool
default = false
}


###################
# Lambda Function
Expand Down