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

Commit

Permalink
Fix data not controlled by var.enabled (#10)
Browse files Browse the repository at this point in the history
Closes #9
  • Loading branch information
yujunz authored and aknysh committed Nov 6, 2019
1 parent cea5cba commit c7bd8be
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are

## Usage


**IMPORTANT:** The `master` branch is used in `source` just as an example. In your code, do not pin to `master` because there may be breaking changes between releases.
Instead pin to the release tag (e.g. `?ref=tags/x.y.z`) of one of our [latest releases](https://github.com/cloudposse/terraform-aws-kops-metadata/releases).


```hcl
module "kops_metadata" {
source = "git::https://github.com/cloudposse/terraform-aws-kops-metadata.git?ref=master"
Expand All @@ -67,7 +72,6 @@ Available targets:
lint Lint terraform code
```

## Inputs

| Name | Description | Type | Default | Required |
Expand All @@ -78,7 +82,7 @@ Available targets:
| masters_name | K8s masters subdomain name in the Kops DNS zone | string | `masters` | no |
| nodes_name | K8s nodes subdomain name in the Kops DNS zone | string | `nodes` | no |
| vpc_tag | Tag used to lookup the Kops VPC | string | `Name` | no |
| vpc_tag_values | Tag values list to lookup the Kops VPC | string | `<list>` | no |
| vpc_tag_values | Tag values list to lookup the Kops VPC | list | `<list>` | no |

## Outputs

Expand Down Expand Up @@ -184,7 +188,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

## Copyright

Copyright © 2017-2018 [Cloud Posse, LLC](https://cpco.io/copyright)
Copyright © 2017-2019 [Cloud Posse, LLC](https://cpco.io/copyright)



Expand Down Expand Up @@ -243,7 +247,7 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
|---|

[aknysh_homepage]: https://github.com/aknysh
[aknysh_avatar]: https://github.com/aknysh.png?size=150
[aknysh_avatar]: https://img.cloudposse.com/150x150/https://github.com/aknysh.png



Expand Down
3 changes: 1 addition & 2 deletions docs/terraform.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## Inputs

| Name | Description | Type | Default | Required |
Expand All @@ -9,7 +8,7 @@
| masters_name | K8s masters subdomain name in the Kops DNS zone | string | `masters` | no |
| nodes_name | K8s nodes subdomain name in the Kops DNS zone | string | `nodes` | no |
| vpc_tag | Tag used to lookup the Kops VPC | string | `Name` | no |
| vpc_tag_values | Tag values list to lookup the Kops VPC | string | `<list>` | no |
| vpc_tag_values | Tag values list to lookup the Kops VPC | list | `<list>` | no |

## Outputs

Expand Down
6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ data "aws_security_group" "nodes" {
}

data "aws_iam_role" "masters" {
name = "${var.masters_name}.${var.dns_zone}"
count = "${var.enabled == "true" ? 1 : 0}"
name = "${var.masters_name}.${var.dns_zone}"
}

data "aws_iam_role" "nodes" {
name = "${var.nodes_name}.${var.dns_zone}"
count = "${var.enabled == "true" ? 1 : 0}"
name = "${var.nodes_name}.${var.dns_zone}"
}
8 changes: 4 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ output "masters_security_group_id" {
}

output "masters_role_name" {
value = "${data.aws_iam_role.masters.id}"
value = "${join("", data.aws_iam_role.masters.*.id)}"
description = "K8s nodes Security Group ARN"
}

output "masters_role_arn" {
value = "${data.aws_iam_role.masters.arn}"
value = "${join("", data.aws_iam_role.masters.*.arn)}"
description = "K8s nodes Security Group ID"
}

Expand All @@ -54,11 +54,11 @@ output "nodes_security_group_id" {
}

output "nodes_role_name" {
value = "${data.aws_iam_role.nodes.id}"
value = "${join("", data.aws_iam_role.nodes.*.id)}"
description = "Kops nodes Role name"
}

output "nodes_role_arn" {
value = "${data.aws_iam_role.nodes.arn}"
value = "${join("", data.aws_iam_role.nodes.*.arn)}"
description = "Kops nodes Role ARN"
}

0 comments on commit c7bd8be

Please sign in to comment.