Skip to content

Commit 140c801

Browse files
Adds GovCloud Support (#3)
* Adds retrieval of current aws partion and logic to set the datadog account id respectively * Adds comments for clarity * Fixes typo * minor cleanup --------- Co-authored-by: Duncan Harvey <[email protected]>
1 parent 0d944e3 commit 140c801

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
data "aws_region" "current" {}
2+
data "aws_partition" "current" {}
23

34
locals {
45
architecture_layer_suffix_map = {
@@ -43,7 +44,8 @@ locals {
4344
datadog_lambda_layer_runtime = lookup(local.runtime_layer_map, var.runtime, "")
4445
datadog_lambda_layer_version = lookup(local.runtime_base_layer_version_map, local.runtime_base, "")
4546

46-
datadog_layer_name_base = "arn:aws:lambda:${data.aws_region.current.name}:464622532012:layer"
47+
datadog_account_id = (data.aws_partition.current.partition == "aws-us-gov") ? "002406178527" : "464622532012"
48+
datadog_layer_name_base = "arn:${data.aws_partition.current.partition}:lambda:${data.aws_region.current.name}:${local.datadog_account_id}:layer"
4749
datadog_layer_suffix = lookup(local.architecture_layer_suffix_map, var.architectures[0])
4850

4951
environment_variables = {

0 commit comments

Comments
 (0)