mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-15 08:14:12 +01:00
use the correct policy arns if the region is in CN (#765)
This commit is contained in:
@@ -11,6 +11,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
- Fix doc about spot instances, cluster-autoscaler should be scheduled on normal instances instead of spot (by @simowaer)
|
||||
- Adding `encrypted` option to worker's root_block_device as read from the worker configurations (by @craig-rueda)
|
||||
- Use correct policy arns for CN regions (cn-north-1, cn-northwest-1) (by @cofyc)
|
||||
|
||||
# History
|
||||
|
||||
|
||||
@@ -96,12 +96,12 @@ resource "aws_iam_role" "cluster" {
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "cluster_AmazonEKSClusterPolicy" {
|
||||
count = var.manage_cluster_iam_resources && var.create_eks ? 1 : 0
|
||||
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
|
||||
policy_arn = "${local.policy_arn_prefix}/AmazonEKSClusterPolicy"
|
||||
role = local.cluster_iam_role_name
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "cluster_AmazonEKSServicePolicy" {
|
||||
count = var.manage_cluster_iam_resources && var.create_eks ? 1 : 0
|
||||
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
|
||||
policy_arn = "${local.policy_arn_prefix}/AmazonEKSServicePolicy"
|
||||
role = local.cluster_iam_role_name
|
||||
}
|
||||
|
||||
2
data.tf
2
data.tf
@@ -221,3 +221,5 @@ data "aws_iam_instance_profile" "custom_worker_group_launch_template_iam_instanc
|
||||
local.workers_group_defaults["iam_instance_profile_name"],
|
||||
)
|
||||
}
|
||||
|
||||
data "aws_region" "current" {}
|
||||
|
||||
1
local.tf
1
local.tf
@@ -22,6 +22,7 @@ locals {
|
||||
default_ami_id_linux = data.aws_ami.eks_worker.id
|
||||
default_ami_id_windows = data.aws_ami.eks_worker_windows.id
|
||||
|
||||
policy_arn_prefix = contains(["cn-northwest-1", "cn-north-1"], data.aws_region.current.name) ? "arn:aws-cn:iam::aws:policy" : "arn:aws:iam::aws:policy"
|
||||
workers_group_defaults_defaults = {
|
||||
name = "count.index" # Name of the worker group. Literal count.index will never be used but if name is not set, the count.index interpolation will be used.
|
||||
tags = [] # A list of map defining extra tags to be applied to the worker group autoscaling group.
|
||||
|
||||
@@ -318,19 +318,19 @@ resource "aws_iam_instance_profile" "workers" {
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "workers_AmazonEKSWorkerNodePolicy" {
|
||||
count = var.manage_worker_iam_resources && var.create_eks ? 1 : 0
|
||||
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy"
|
||||
policy_arn = "${local.policy_arn_prefix}/AmazonEKSWorkerNodePolicy"
|
||||
role = aws_iam_role.workers[0].name
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "workers_AmazonEKS_CNI_Policy" {
|
||||
count = var.manage_worker_iam_resources && var.attach_worker_cni_policy && var.create_eks ? 1 : 0
|
||||
policy_arn = "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
|
||||
policy_arn = "${local.policy_arn_prefix}/AmazonEKS_CNI_Policy"
|
||||
role = aws_iam_role.workers[0].name
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "workers_AmazonEC2ContainerRegistryReadOnly" {
|
||||
count = var.manage_worker_iam_resources && var.create_eks ? 1 : 0
|
||||
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
|
||||
policy_arn = "${local.policy_arn_prefix}/AmazonEC2ContainerRegistryReadOnly"
|
||||
role = aws_iam_role.workers[0].name
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user