Commit Graph

45 Commits

Author SHA1 Message Date
Anton Babenko
2bdf7d7dd6 refactor: Refactoring to match the rest of terraform-aws-modules (#1583) 2021-09-16 11:35:44 +02:00
Thierno IB. BARRY
6d7d6f6f5a feat: Drop random pets from Managed Node Groups (#1372)
BREAKING CHANGES: We now decided to remove `random_pet` resources in Managed Node Groups (MNG). Those were used to recreate MNG if something change and also simulate the newly added argument `node_group_name_prefix`. But they were causing a lot of troubles. To upgrade the module without recreating your MNG, you will need to explicitly reuse their previous name and set them in your MNG `name` argument. Please see [upgrade docs](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/upgrades.md#upgrade-module-to-v1700-for-managed-node-groups) for more details.
2021-05-28 01:50:16 +02:00
Thierno IB. BARRY
e3bf48bba2 feat: Replace the local-exec script with a http datasource for waiting cluster (#1339)
NOTES: Using the [terraform-aws-modules/http](https://registry.terraform.io/providers/terraform-aws-modules/http/latest) provider is a more platform agnostic way to wait for the cluster availability than using a local-exec. With this change we're able to provision EKS clusters and manage the `aws_auth` configmap while still using the `hashicorp/tfc-agent` docker image.
2021-05-17 10:11:36 +02:00
Thierno IB. BARRY
0d77e30075 feat: Add EKS Fargate support (#1067)
Co-authored-by: Simon Gurcke <simon@gurcke.de>
Co-authored-by: Daniel Piddock <33028589+dpiddockcmp@users.noreply.github.com>
2020-11-07 23:03:12 +01:00
Guillaume GILL
751c422330 feat: Add kubernetes standard labels to avoid manual mistakes on the managed aws-auth configmap (#989) 2020-10-25 15:14:50 +01:00
Thierno IB. BARRY
d97edde9cd fix: Use splat syntax to avoid errors during destroy with an empty state (#1041) 2020-10-12 21:59:29 +02:00
Brandon McNama
7ffe5fa88f fix: Work around path bug in aws-iam-authenticator (#894)
* fix: Work around path bug in aws-iam-authenticator

`aws-iam-authenticator` has an open issue where it will not recognize
IAM roles that include paths. This change causes the path supplied to
`var.iam_path` to be stripped when generating the `aws-auth` ConfigMap
in order to work around this.

https://github.com/kubernetes-sigs/aws-iam-authenticator/issues/153
https://github.com/aws/containers-roadmap/issues/926
2020-05-30 22:25:50 +02:00
keznikl
36d1b5afa5 fix: Wrap local.configmap_roles.groups with tolist() to avoid panic (#846) 2020-04-23 16:57:58 +02:00
sr-n
e41c4aa78a fix: Prevent coalescelist null argument error when destroying worker_group_launch_templates (#842)
Resolves #841
2020-04-22 19:36:03 +02:00
Valeri GOLUBEV
2fd078e7c1 feat: Add support for EC2 principal in assume worker role policy for China (#827)
* Add support for EC2 principal in assume worker role policy for  China AWS

* Remove local partition  according to requested change

Co-authored-by: Valeri GOLUBEV <vgolubev@kyriba.com>
2020-04-11 14:11:22 +02:00
Daniel Piddock
3957a7c02c improvement: Generate aws-auth configmap's roles from Object. No more string concat. (#790)
Do not use string concat to generate a YAML data structure

Co-authored-by: Thierno IB. BARRY <ibrahima.br@gmail.com>
2020-03-18 08:58:19 +01:00
Sanjeev Giri
905d9f05a9 Configurable local exec command for waiting until cluster is healthy (#701)
* Configurable local exec command for waiting until cluster is healthy

* readme

* line feeds

* format

* fix readme

* fix readme

* Configurable local exec command for waiting until cluster is healthy (#1)

* Configurable local exec command for waiting until cluster is healthy

* readme

* line feeds

* format

* fix readme

* fix readme

* change log

* Configurable local exec wait 4 cluster op (#2)

* Configurable local exec command for waiting until cluster is healthy

* readme

* line feeds

* format

* fix readme

* fix readme

* change log

* changelog (#3)

* Changelog (#4)

* changelog

* changelog

* simplify wait_for_cluster command

* readme

* no op for manage auth false

* formatting

* docs? not sure

* linter

* specify dependency to wait for cluster more accurately
2020-01-27 16:29:24 +01:00
Daniel Piddock
11147e9af3 Node groups submodule (#650)
* WIP Move node_groups to a submodule

* Split the old node_groups file up

* Start moving locals

* Simplify IAM creation logic

* depends_on from the TF docs

* Wire in the variables

* Call module from parent

* Allow to customize the role name. As per workers

* aws_auth ConfigMap for node_groups

* Get the managed_node_groups example to plan

* Get the basic example to plan too

* create_eks = false works

"The true and false result expressions must have consistent types. The
given expressions are object and object, respectively."
Well, that's useful. But apparently set(string) and set() are ok. So
everything else is more complicated. Thanks.

* Update Changelog

* Update README

* Wire in node_groups_defaults

* Remove node_groups from workers_defaults_defaults

* Synchronize random and node_group defaults

* Error: "name_prefix" cannot be longer than 32

* Update READMEs again

* Fix double destroy

Was producing index errors when running destroy on an empty state.

* Remove duplicate iam_role in node_group

I think this logic works. Needs some testing with an externally created
role.

* Fix index fail if node group manually deleted

* Keep aws_auth template in top module

Downside: count causes issues as usual: can't use distinct() in the
child module so there's a template render for every node_group even if
only one role is really in use. Hopefully just output noise instead of
technical issue

* Hack to have node_groups depend on aws_auth etc

The AWS Node Groups create or edit the aws-auth ConfigMap so that nodes
can join the cluster. This breaks the kubernetes resource which cannot
do a force create. Remove the race condition with explicit depend.

Can't pull the IAM role out of the node_group any more.

* Pull variables via the random_pet to cut logic

No point having the same logic in two different places

* Pass all ForceNew variables through the pet

* Do a deep merge of NG labels and tags

* Update README.. again

* Additional managed node outputs #644

Add change from @TBeijin from PR #644

* Remove unused local

* Use more for_each

* Remove the change when create_eks = false

* Make documentation less confusing

* node_group version user configurable

* Pass through raw output from aws_eks_node_groups

* Merge workers defaults in the locals

This simplifies the random_pet and aws_eks_node_group logic. Which was
causing much consernation on the PR.

* Fix typo

Co-authored-by: Max Williams <max.williams@deliveryhero.com>
2020-01-09 12:53:08 +01:00
Shaun Cutts
d79c8ab6f2 Wait cluster responsive (#639)
* wait for cluster to respond before creating auth config map

* adds changelog entry

* fixup tf format

* fixup kubernetes required version

* fixup missing local for kubeconfig_filename

* combine wait for cluster into provisioner on cluster; change status check to /healthz on endpoint

* fix: make kubernetes provider version more permissive
2020-01-07 12:28:56 +01:00
Will Bertelsen
bad9604882 Fix aws-auth config map for managed node groups (#627)
* Fix aws-auth config map for managed node groups

This change adds the IAM role used for each managed node group to the
aws-auth config map. This fixes an issue where managed nodes could not
access the EKS kubernetes API server.

* update changelog

* fix format

* add comment

Co-authored-by: Max Williams <max.williams@deliveryhero.com>
2019-12-20 17:30:40 +01:00
Tomislav Tomašić
124ea7c151 Add destroy time flag (#580)
* Add destroy-time flag

* Update changelog

Fix cluster count

* Fix cluster count

* Fix docs

* Fix outputs

* Fix unsupported attribute on cluster_certificate_authority_data output

Co-Authored-By: Daniel Piddock <33028589+dpiddockcmp@users.noreply.github.com>

* Remove unnecessary flatten from cluster_endpoint output

Co-Authored-By: Daniel Piddock <33028589+dpiddockcmp@users.noreply.github.com>

* Improve description of var.enabled

* Fix errors manifesting when used on an existing-cluster

* Update README.md

* Renamed destroy-time flag

* Revert removal of changelog addition entry

* Update flag name in readme

* Update flag variable name

* Update cluster referencing for consistency

* Update flag name to `create_eks`

* Fixed incorrect count-based reference to aws_eks_cluster.this (there's only one)

* Replaced all incorrect aws_eks_cluster.this[count.index] references (there will be just one, so using '[0]').

* Changelog update, explicitly mentioning flag

* Fixed interpolation deprecation warning

* Fixed outputs to support conditional cluster

* Applied create_eks to aws_auth.tf

* Removed unused variable. Updated Changelog. Formatting.

* Fixed references to aws_eks_cluster.this[0] that would raise errors when setting create_eks to false whilst having launch templates or launch configurations configured.

* Readme and example updates.

* Revert "Readme and example updates."

This reverts commit 18a0746355e136010ad54858a1b518406f6a3638.

* Updated readme section of conditionally creation with provider example.

* Added conditions to node_groups.

* Fixed reversed map_roles check

* Update aws_auth.tf

Revert this due to https://github.com/terraform-aws-modules/terraform-aws-eks/pull/611
2019-12-09 10:06:10 +01:00
Shan K
143642fda8 remove empty [] to mapRoles in aws-auth (revised) (#619) 2019-12-09 09:56:55 +01:00
Shan K
fb61b48c26 Fix PR merge: #606 (#611)
* Update aws_auth.tf

* aws-auth config map
2019-12-05 16:54:13 +01:00
Shan K
9de5b53cb4 remove empty [] to mapRoles object in aws-auth (#606)
* remove empty [] to mapRoles object in aws-auth

Simply having ${yamlencode(var.map_roles)} in mapRoles for aws-auth 
creates a empty [] at the end after adding the default roles.
Changing it to be added only when its not empty

* Update aws_auth.tf
2019-12-04 18:46:44 +01:00
Stijn De Haes
9363662574 Use kubernetes provider to manage aws auth (#355)
This commit changes the way aws auth is managed. Before a local file
was used the generate the template and a null resource to apply it. This
is now switched to the terraform kubernetes provider.
2019-11-28 10:25:13 +01:00
Mary Hayes
b69c8fb759 Run aws-auth Update Commands in Sequence and not Parallel (#592)
* Run aws-auth Update Commands in Sequence and not Parallel

* Update changelog
2019-11-20 13:23:56 +01:00
Joonsung Lee
2d52e06786 Add Windows support (#555)
* Add Windows support

* Assign eks:kube-proxy-windows group to worker nodes

* Add Instructions for adding Windows Workers at FAQ.md

* Remove unnecessary variables from userdata_windows.tpl

* Update CHANGELOG.md
2019-10-28 14:16:45 +01:00
Sergiu Plotnicu
461cf5482e Support for Mixed Instances ASG in worker_groups_launch_template variable (#468)
* Create ASG tags via for - utility from terraform 12

* Updated support for mixed ASG in worker_groups_launch_template variable

* Updated launch_template example to include spot and mixed ASG with worker_groups_launch_template variable

* Removed old config

* Removed workers_launch_template_mixed.tf file, added support for mixed/spot in workers_launch_template variable

* Updated examples/spot_instances/main.tf with Mixed Spot and ondemand instances

* Removed launch_template_mixed from relevant files

* Updated README.md file

* Removed workers_launch_template.tf.bkp

* Fixed case with null on_demand_allocation_strategy and Spot allocation

* Fixed workers_launch_template.tf, covered spot instances via Launch Template
2019-09-13 16:50:59 +02:00
刘相轩
8580b67813 Support map users and roles to multiple groups (#424)
* Support map users and roles to multiple groups

* Simplify code by rename `user_arn` to `userarn`, `role_arn` to `rolearn`

* Next version should be 6.x because PR this is a breaking change.

* Update example variables.tf

* Change indent to 2

* Fix map-aws-auth.yaml maybe invalid yaml.
2019-08-19 16:15:01 +02:00
Karoline Pauls
630a0cc3fb Fix fmt for v0.12.6 (#460) 2019-08-06 17:26:05 +02:00
刘相轩
da2c78b8ba Upgrade to terraform 0.12 (#394)
* run terraform upgrade tool

* fix post upgrade TODOs

* use strict typing for variables

* upgrade examples, point them at VPC module tf 0.12 PR

* remove unnecessary `coalesce()` calls

coalesce(lookup(map, key, ""), default) -> lookup(map, key, default)

* Fix autoscaling_enabled broken (#1)

* always set a value for tags, fix coalescelist calls

* always set a value for these tags

* fix tag value

* fix tag value

* default element available

* added default value

* added a general default

without this default - TF is throwing an error when running a destroy

* Fix CI

* Change vpc module back to `terraform-aws-modules/vpc/aws` in example

* Update CHANGELOG.md

* Change type of variable `cluster_log_retention_in_days` to number

* Remove `xx_count` variables

* Actual lists instead of strings with commas

* Remove `xx_count` variable from docs

* Replace element with list indexing

* Change variable `worker_group_tags` to a attribute of worker_group

* Fix workers_launch_template_mixed tags

* Change override_instance_type_x variables to list.

* Update CHANGELOG.md
2019-06-19 09:57:51 +02:00
Max Williams
d6fa9f48ff Better examples, PR template changes, general tidy up (#375)
* adding 3 examples

* removing old example

* updating PR template

* fix this typo

* update after renaming default example

* add missing launch_template_mixed stuff to aws_auth

* fix 2 examples with public subnets

* update changelog for new minor release
2019-05-08 15:11:05 +02:00
Max Williams
ae2f8e58db Adding new mixed type of worker group with instance overrides and mixed instances policy (#371)
* Adding new mixed type of worker group with instance overrides and mixed instances policy

* moving all count and lifecycle rule parameters to top/bottom

* adding custom IAM parts

* updating doc with new options

* fixes for spot instances
2019-05-07 16:50:42 +02:00
Touch Ungboriboonpisal
959e5330e3 Support custom IAM roles for cluster and workers (#338)
* allow specifying custom worker IAM instance profiles

* allow specifying custom cluster IAM role

* add doc

* update changelog

* use data.aws_iam_instance_profile.name
2019-05-07 14:46:06 +02:00
yutachaos
d3c1bd6237 Added write_aws_auth_config option (#228)
* Added update aws auth configmap when manage_aws_auth set false case
and `write_aws_auth_config` variable for not create the aws_auth files option

* Add CHANGELOG

* Changed writing config file process for Windows compatibility.

* Apply terraform-docs and terraform fmt

* Fixed zsh-specific syntax

* Fixed CHANGELOG.md
2019-02-01 13:02:41 +01:00
Erik Lattimore
03c223131f Fix issue where ConfigMap isn't applied to new cluster (#235)
If you are trying to recover a cluster that was deleted, the current
code will not re-apply the ConfigMap because it is already rendered so
kubectl command won't get triggered.

This change adds the cluster endpoint (which should be different when
spinning up a new cluster even with the same name) so we will force a
re-render and cause the kubectl command to run.
2019-01-15 12:14:52 +01:00
Marcello Romani
91eb56f4aa Fix zsh-specific syntax in retry loop within null_resource.update_config_map_aws_auth (#245)
* Fixed zsh-specific syntax, fail if kubectl apply fails after 10 attempts

* Updated CHANGELOG
2019-01-15 12:11:24 +01:00
skang0601
f3ab7c67da Allows worker groups to be created using AWS Launch Templates (#222) 2019-01-10 16:19:19 +01:00
Diego Rodriguez
1822a677dc Supply count for map_accounts, map_roles and map_users (#205)
* Added map_roles_count and user_roles_count (#1)

* Update readme for new vars

* updated tests to include count

* fix syntax error

* updated changelog

* Added map_accounts_count variable for consistency

* Fix counts in example and user latest terraform-docs to generate readme
2018-12-13 15:50:46 +01:00
Andrew Roth
edbea30cfc Fix #187 for windows compatibility (#207)
* Added ability to choose local-exec interpreter

* Remove accidental extra file

* formatting
2018-12-11 14:55:26 +01:00
rmakram-ims
81706207fc Add wait_nodes_max_tries to wait for nodes to be available before applying the kubernetes configurations (#187)
* Add wait_nodes_max_tries to wait for nodes to be available before applying the kubernetes configurations

* Format variables.tf and aws_auth.tf

* Fix template expansion for wait-nodes-ready.tpl

* Ensuring that kubeconfig is created before its use

* Cleanup wait-nodes-ready script

* Simplify logic to retry application of kubernetes config if failed

* Revert file permission change
2018-12-04 09:17:27 +01:00
Matthew Caya
cd7e56c821 Fixed issue with 'workers_group_defaults_defaults.iam_role_id' and added explicit depends_on for 'update_config_map_aws_auth' (#147)
* fix worker default 'iam_role_id' dependency

* Add explicit depends_on to eks cluster for 'update_config_map_aws_auth'
2018-10-09 10:38:00 +02:00
Andrew Lavery
b623bc234a allow specifying an IAM role for each worker group (#137)
* allow creating an IAM role for each worker group

* moved change from 'changed' to 'added'

* create multiple roles not just profiles

* fix config_map_aws_auth generation

* don't duplicate worker-role templating

* specify ARNs for worker groups individually

todo fix aws_auth configmap

* fixed AWS auth

* fix aws_iam_instance_profile.workers name
fix iam_instance_profile fallback

* fix outputs

* fix iam_instance_profile calculation

* hopefully fix aws auth configmap generation

* manually fill out remainder of arn

* remove depends_on in worker_role_arns template file

this was causing resources to be recreated every time

* fmt

* fix typo, move iam_role_id default to defaults map
2018-09-24 16:08:35 +02:00
Brandon O'Connor
66e3403387 test fixture produced an error for the path of kubectl being .// removed the extra slash to fix 2018-07-11 23:32:48 -07:00
Max Williams
404645501d Merge branch 'master' into aws-auth_enhancemnts 2018-07-11 10:57:58 +02:00
Max Williams
6f886e6d37 fixing readme.md
Merge remote-tracking branch 'origin/aws-auth_enhancemnts' into aws-auth_enhancemnts
2018-07-11 10:54:39 +02:00
Max Williams
bb9e241021 finishing doc, tests etc 2018-07-11 10:22:32 +02:00
Max Williams
58c4a0e30f initial commit 2018-07-11 10:21:53 +02:00
Max Williams
2a0a595940 renaming resource and removing trigger 2018-07-10 10:23:48 +02:00
Max Williams
1a1d92da66 Splitting aws-auth and kubectl related resources as they are not related 2018-07-09 12:23:57 +02:00