Skip to content

Commit

Permalink
PLAT-7025 Add CreateServiceLinkedRole perms to create-eks-role. Neede…
Browse files Browse the repository at this point in the history
…d for fresh accounts. (#115)

* PLAT-7025 Add CreateServiceLinkedRole perms to create-eks-role. Needed for fresh accounts.

* Add Israel region
  • Loading branch information
miguelhar authored Aug 2, 2023
1 parent ae85969 commit fcd47f8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion iam-bootstrap/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variable "region" {
description = "AWS region for the deployment"
nullable = false
validation {
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af|il)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
error_message = "The provided region must follow the format of AWS region names, e.g., us-west-2, us-gov-west-1."
}
}
Expand Down
12 changes: 12 additions & 0 deletions iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ data "aws_iam_policy_document" "create_eks_role" {
resources = ["arn:${data.aws_partition.current.partition}:iam::${local.aws_account_id}:role/${var.deploy_id}-*"]
effect = "Allow"
}

statement {
sid = "EKSDeployerIAMSvcLinkedRole"
actions = [
"iam:CreateServiceLinkedRole",
"iam:AttachRolePolicy",
"iam:PutRolePolicy"
]
resources = ["arn:${data.aws_partition.current.partition}:iam::${local.aws_account_id}:role/aws-service-role/*"]
effect = "Allow"
}

}

resource "aws_iam_policy" "create_eks_role" {
Expand Down
2 changes: 1 addition & 1 deletion submodules/bastion/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variable "region" {
type = string
nullable = false
validation {
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af|il)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
error_message = "The provided region must follow the format of AWS region names, e.g., us-west-2, us-gov-west-1."
}
}
Expand Down
2 changes: 1 addition & 1 deletion submodules/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variable "region" {
description = "AWS region for the deployment"
nullable = false
validation {
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af|il)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
error_message = "The provided region must follow the format of AWS region names, e.g., us-west-2, us-gov-west-1."
}
}
Expand Down
2 changes: 1 addition & 1 deletion submodules/network/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variable "region" {
description = "AWS region for the deployment"
nullable = false
validation {
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af|il)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
error_message = "The provided region must follow the format of AWS region names, e.g., us-west-2, us-gov-west-1."
}
}
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "region" {
description = "AWS region for the deployment"
nullable = false
validation {
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa|me|af|il)-(central|(north|south)?(east|west)?)-[0-9]", var.region))
error_message = "The provided region must follow the format of AWS region names, e.g., us-west-2, us-gov-west-1."
}
}
Expand Down

0 comments on commit fcd47f8

Please sign in to comment.