Skip to content
This repository has been archived by the owner on Jan 31, 2021. It is now read-only.

Commit

Permalink
Allow nodes to assume role (#3)
Browse files Browse the repository at this point in the history
* Allow nodes assume role

* Format fix

* Address PR comments
  • Loading branch information
goruha authored May 29, 2018
1 parent 6552674 commit bc4cc19
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
.terraform/
.idea
*.iml

.build-harness
build-harness
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module "kops_external_dns" {
name = "external-dns"
cluster_name = "us-east-1.cloudposse.com"
masters_name = "masters"
nodes_name = "nodes"
tags = {
Cluster = "us-east-1.cloudposse.com"
Expand All @@ -44,6 +45,7 @@ module "kops_external_dns" {
| `tags` | `{}` | Additional tags (_e.g._ `map("Cluster","us-east-1.cloudposse.com")` | No |
| `delimiter` | `-` | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | No |
| `masters_name` | `masters` | Kops masters subdomain name in the cluster DNS zone | No |
| `nodes_name` | `nodes` | Kops nodes subdomain name in the cluster DNS zone | No |


## Outputs
Expand Down
9 changes: 7 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module "kops_metadata" {
source = "git::https://github.com/cloudposse/terraform-aws-kops-metadata.git?ref=tags/0.1.1"
dns_zone = "${var.cluster_name}"
masters_name = "${var.masters_name}"
nodes_name = "${var.nodes_name}"
}

resource "aws_iam_role" "default" {
Expand All @@ -37,8 +38,12 @@ data "aws_iam_policy_document" "assume_role" {
}

principals {
type = "AWS"
identifiers = ["${module.kops_metadata.masters_role_arn}"]
type = "AWS"

identifiers = [
"${module.kops_metadata.masters_role_arn}",
"${module.kops_metadata.nodes_role_arn}",
]
}

effect = "Allow"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ variable "masters_name" {
default = "masters"
description = "Kops masters subdomain name in the cluster DNS zone"
}

variable "nodes_name" {
type = "string"
default = "nodes"
description = "Kops nodes subdomain name in the cluster DNS zone"
}

0 comments on commit bc4cc19

Please sign in to comment.