Skip to content

Commit 47ab3eb

Browse files
authored
fix: Correct Karpenter EC2 service principal DNS suffix in non-commercial regions (#3157)
1 parent 71d1947 commit 47ab3eb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.95.0
3+
rev: v1.96.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs

modules/karpenter/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ data "aws_caller_identity" "current" {}
44

55
locals {
66
account_id = data.aws_caller_identity.current.account_id
7+
dns_suffix = data.aws_partition.current.dns_suffix
78
partition = data.aws_partition.current.partition
89
region = data.aws_region.current.name
910
}
@@ -286,7 +287,7 @@ data "aws_iam_policy_document" "node_assume_role" {
286287

287288
principals {
288289
type = "Service"
289-
identifiers = ["ec2.amazonaws.com"]
290+
identifiers = ["ec2.${local.dns_suffix}"]
290291
}
291292
}
292293
}

0 commit comments

Comments
 (0)