Commit 5692bf8d authored by Chris Merrett's avatar Chris Merrett

Tweaked the way that role based access works for Heptio auth

parent 6c57b145
Pipeline #4980 passed with stage
in 16 seconds
...@@ -61,3 +61,7 @@ resource "aws_iam_role" "admin" { ...@@ -61,3 +61,7 @@ resource "aws_iam_role" "admin" {
assume_role_policy = "${data.aws_iam_policy_document.admin.json}" assume_role_policy = "${data.aws_iam_policy_document.admin.json}"
} }
resource "aws_iam_group" "admin" {
name = "${var.cluster_name}-eks-kubernetes-admin"
}
...@@ -55,6 +55,7 @@ data "aws_iam_policy_document" "admin" { ...@@ -55,6 +55,7 @@ data "aws_iam_policy_document" "admin" {
identifiers = [ identifiers = [
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:root", "arn:aws:iam::${data.aws_caller_identity.current.account_id}:root",
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:group/${var.cluster_name}-eks-kubernetes-admin",
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/Steamhaus", "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/Steamhaus",
] ]
} }
...@@ -69,6 +70,7 @@ data "template_file" "kubeconfig" { ...@@ -69,6 +70,7 @@ data "template_file" "kubeconfig" {
endpoint = "${aws_eks_cluster.cluster.endpoint}" endpoint = "${aws_eks_cluster.cluster.endpoint}"
region = "${data.aws_region.current.name}" region = "${data.aws_region.current.name}"
cluster_auth_base64 = "${aws_eks_cluster.cluster.certificate_authority.0.data}" cluster_auth_base64 = "${aws_eks_cluster.cluster.certificate_authority.0.data}"
admin_role_arn = "${aws_iam_role.admin.arn}"
} }
} }
...@@ -76,8 +78,9 @@ data "template_file" "config_map_aws_auth" { ...@@ -76,8 +78,9 @@ data "template_file" "config_map_aws_auth" {
template = "${file("${path.module}/templates/config-map-aws-auth.yaml.tpl")}" template = "${file("${path.module}/templates/config-map-aws-auth.yaml.tpl")}"
vars { vars {
role_arn = "${aws_iam_role.workers.arn}" role_arn = "${aws_iam_role.workers.arn}"
admin_role_arn = "${aws_iam_role.admin.arn}" admin_role_arn = "${aws_iam_role.admin.arn}"
steamhaus_role_arn = "${var.steamhaus_role_arn}"
} }
} }
......
...@@ -14,3 +14,7 @@ data: ...@@ -14,3 +14,7 @@ data:
username: kubernetes-admin username: kubernetes-admin
groups: groups:
- system:masters - system:masters
- rolearn: ${steamhaus_role_arn}
username: steamhaus-admin
groups:
- system:masters
...@@ -25,3 +25,5 @@ users: ...@@ -25,3 +25,5 @@ users:
- "token" - "token"
- "-i" - "-i"
- "${cluster_name}" - "${cluster_name}"
#- "-r"
#- "${admin_role_arn}"
...@@ -55,3 +55,7 @@ variable "alt_dns_cluster_ip" { ...@@ -55,3 +55,7 @@ variable "alt_dns_cluster_ip" {
description = "Alternate DNS cluster IP address on different (non 10.x.x.x) range - this is a fallback" description = "Alternate DNS cluster IP address on different (non 10.x.x.x) range - this is a fallback"
default = "172.20.0.10" default = "172.20.0.10"
} }
variable "steamhaus_role_arn" {
description = "Role ARN within the account for Steamhaus federated access"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment