Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the ability to optionally specify workers_ami_id #5

Merged
merged 1 commit into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
project adheres to [Semantic Versioning](http://semver.org/).

## [[v0.2.0](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v0.1.1...v0.2.0)] - 2018-06-08]

### Changed

- `worker_ami_id` is now made optional. If not specified, the module will source the latest AWS supported EKS AMI instead.

## [[v0.1.1](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v0.1.0...v0.1.1)] - 2018-06-07]

### Changed

- pre-commit hooks fixed and working.
- made progress on CI, advancing the build to the final `kitchen test` stage before failing.

## [v0.1.0] - 2018-06-07

### Added

- Everything! Initial release of the module.
- Kudos to @tanmng for finding and fixing bug #1.
- added a local variable to do a lookup against for a dynamic value in userdata which was previously static. Kudos to @tanmng for finding and fixing bug #1!
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| cluster_ingress_cidrs | The CIDRs from which we can execute kubectl commands. | list | - | yes |
| cluster_name | Name of the EKS cluster. | string | - | yes |
| cluster_name | Name of the EKS cluster which is also used as a prefix in names of related resources. | string | - | yes |
| cluster_version | Kubernetes version to use for the cluster. | string | `1.10` | no |
| subnets | A list of subnets to associate with the cluster's underlying instances. | list | - | yes |
| tags | A map of tags to add to all resources | string | `<map>` | no |
| tags | A map of tags to add to all resources. | string | `<map>` | no |
| vpc_id | VPC id where the cluster and other resources will be deployed. | string | - | yes |
| workers_ami_id | AMI ID for the eks workers. | string | - | yes |
| workers_asg_desired_capacity | description | string | `1` | no |
| workers_asg_max_size | description | string | `3` | no |
| workers_asg_min_size | description | string | `1` | no |
| workers_ami_id | AMI ID for the eks workers. If none is provided, Terraform will search for the latest version of their EKS optimized worker AMI. | string | `` | no |
| workers_asg_desired_capacity | Desired worker capacity in the autoscaling group. | string | `1` | no |
| workers_asg_max_size | Maximum worker capacity in the autoscaling group. | string | `3` | no |
| workers_asg_min_size | Minimum worker capacity in the autoscaling group. | string | `1` | no |
| workers_instance_type | Size of the workers instances. | string | `m4.large` | no |

## Outputs
Expand Down
10 changes: 10 additions & 0 deletions data.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
data "aws_region" "current" {}

data "aws_ami" "eks_worker" {
filter {
name = "name"
values = ["eks-worker-*"]
}

most_recent = true
owners = ["602401143452"] # Amazon
}

data "aws_iam_policy_document" "workers_assume_role_policy" {
statement {
sid = "EKSWorkerAssumeRole"
Expand Down
11 changes: 0 additions & 11 deletions examples/eks_test_fixture/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ provider "random" {
provider "http" {}
provider "local" {}

data "aws_ami" "eks_worker" {
filter {
name = "name"
values = ["eks-worker-*"]
}

most_recent = true
owners = ["602401143452"] # Amazon
}

data "aws_availability_zones" "available" {}

data "http" "workstation_external_ip" {
Expand Down Expand Up @@ -75,7 +65,6 @@ module "eks" {
subnets = "${module.vpc.public_subnets}"
tags = "${local.tags}"
vpc_id = "${module.vpc.vpc_id}"
workers_ami_id = "${data.aws_ami.eks_worker.id}"
cluster_ingress_cidrs = ["${local.workstation_external_cidr}"]
workers_instance_type = "t2.small"
}
13 changes: 7 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ variable "cluster_ingress_cidrs" {
}

variable "cluster_name" {
description = "Name of the EKS cluster."
description = "Name of the EKS cluster which is also used as a prefix in names of related resources."
}

variable "cluster_version" {
Expand All @@ -18,7 +18,7 @@ variable "subnets" {
}

variable "tags" {
description = "A map of tags to add to all resources"
description = "A map of tags to add to all resources."
default = {}
}

Expand All @@ -27,21 +27,22 @@ variable "vpc_id" {
}

variable "workers_ami_id" {
description = "AMI ID for the eks workers."
description = "AMI ID for the eks workers. If none is provided, Terraform will search for the latest version of their EKS optimized worker AMI."
default = ""
}

variable "workers_asg_desired_capacity" {
description = "description"
description = "Desired worker capacity in the autoscaling group."
default = "1"
}

variable "workers_asg_max_size" {
description = "description"
description = "Maximum worker capacity in the autoscaling group."
default = "3"
}

variable "workers_asg_min_size" {
description = "description"
description = "Minimum worker capacity in the autoscaling group."
default = "1"
}

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.1
v0.2.0
2 changes: 1 addition & 1 deletion workers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "aws_launch_configuration" "workers" {
associate_public_ip_address = true
name_prefix = "${var.cluster_name}"
iam_instance_profile = "${aws_iam_instance_profile.workers.name}"
image_id = "${var.workers_ami_id}"
image_id = "${var.workers_ami_id == "" ? data.aws_ami.eks_worker.id : var.workers_ami_id}"
instance_type = "${var.workers_instance_type}"
security_groups = ["${aws_security_group.workers.id}"]
user_data_base64 = "${base64encode(local.workers_userdata)}"
Expand Down