fix: Correct Karpenter EC2 service principal DNS suffix in non-commercial regions (#3157)

This commit is contained in:
Bryant Biggs
2024-09-16 10:36:15 -05:00
committed by GitHub
parent 71d19472f2
commit 47ab3eb884
2 changed files with 3 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.95.0
rev: v1.96.0
hooks:
- id: terraform_fmt
- id: terraform_docs

View File

@@ -4,6 +4,7 @@ data "aws_caller_identity" "current" {}
locals {
account_id = data.aws_caller_identity.current.account_id
dns_suffix = data.aws_partition.current.dns_suffix
partition = data.aws_partition.current.partition
region = data.aws_region.current.name
}
@@ -286,7 +287,7 @@ data "aws_iam_policy_document" "node_assume_role" {
principals {
type = "Service"
identifiers = ["ec2.amazonaws.com"]
identifiers = ["ec2.${local.dns_suffix}"]
}
}
}