feat: Made it clear that we stand with Ukraine

This commit is contained in:
Anton Babenko
2022-03-12 11:10:02 +01:00
parent 6fe818d0a3
commit fad350d5bf
3 changed files with 29 additions and 9 deletions

View File

@@ -2,6 +2,8 @@
Terraform module which creates AWS EKS (Kubernetes) resources Terraform module which creates AWS EKS (Kubernetes) resources
[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
## Available Features ## Available Features
- AWS EKS Cluster - AWS EKS Cluster
@@ -905,6 +907,7 @@ Full contributing [guidelines are covered here](https://github.com/terraform-aws
| <a name="input_node_security_group_use_name_prefix"></a> [node\_security\_group\_use\_name\_prefix](#input\_node\_security\_group\_use\_name\_prefix) | Determines whether node security group name (`node_security_group_name`) is used as a prefix | `string` | `true` | no | | <a name="input_node_security_group_use_name_prefix"></a> [node\_security\_group\_use\_name\_prefix](#input\_node\_security\_group\_use\_name\_prefix) | Determines whether node security group name (`node_security_group_name`) is used as a prefix | `string` | `true` | no |
| <a name="input_openid_connect_audiences"></a> [openid\_connect\_audiences](#input\_openid\_connect\_audiences) | List of OpenID Connect audience client IDs to add to the IRSA provider | `list(string)` | `[]` | no | | <a name="input_openid_connect_audiences"></a> [openid\_connect\_audiences](#input\_openid\_connect\_audiences) | List of OpenID Connect audience client IDs to add to the IRSA provider | `list(string)` | `[]` | no |
| <a name="input_prefix_separator"></a> [prefix\_separator](#input\_prefix\_separator) | The separator to use between the prefix and the generated timestamp for resource names | `string` | `"-"` | no | | <a name="input_prefix_separator"></a> [prefix\_separator](#input\_prefix\_separator) | The separator to use between the prefix and the generated timestamp for resource names | `string` | `"-"` | no |
| <a name="input_putin_khuylo"></a> [putin\_khuylo](#input\_putin\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |
| <a name="input_self_managed_node_group_defaults"></a> [self\_managed\_node\_group\_defaults](#input\_self\_managed\_node\_group\_defaults) | Map of self-managed node group default configurations | `any` | `{}` | no | | <a name="input_self_managed_node_group_defaults"></a> [self\_managed\_node\_group\_defaults](#input\_self\_managed\_node\_group\_defaults) | Map of self-managed node group default configurations | `any` | `{}` | no |
| <a name="input_self_managed_node_groups"></a> [self\_managed\_node\_groups](#input\_self\_managed\_node\_groups) | Map of self-managed node group definitions to create | `any` | `{}` | no | | <a name="input_self_managed_node_groups"></a> [self\_managed\_node\_groups](#input\_self\_managed\_node\_groups) | Map of self-managed node group definitions to create | `any` | `{}` | no |
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | A list of subnet IDs where the EKS cluster (ENIs) will be provisioned along with the nodes/node groups. Node groups can be deployed within a different set of subnet IDs from within the node group configuration | `list(string)` | `[]` | no | | <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | A list of subnet IDs where the EKS cluster (ENIs) will be provisioned along with the nodes/node groups. Node groups can be deployed within a different set of subnet IDs from within the node group configuration | `list(string)` | `[]` | no |
@@ -945,3 +948,10 @@ Full contributing [guidelines are covered here](https://github.com/terraform-aws
## License ## License
Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/tree/master/LICENSE) for full details. Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/tree/master/LICENSE) for full details.
## Additional terms of use for users from Russia and Belarus
By using the code provided in this repository you agree with the following:
* Russia has [illegally annexed Crimea in 2014](https://en.wikipedia.org/wiki/Annexation_of_Crimea_by_the_Russian_Federation) and [brought the war in Donbas](https://en.wikipedia.org/wiki/War_in_Donbas) followed by [full-scale invasion of Ukraine in 2022](https://en.wikipedia.org/wiki/2022_Russian_invasion_of_Ukraine).
* Russia has brought sorrow and devastations to millions of Ukrainians, killed hundreds of innocent people, damaged thousands of buildings, and forced several million people to flee.
* [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)

22
main.tf
View File

@@ -1,11 +1,15 @@
data "aws_partition" "current" {} data "aws_partition" "current" {}
locals {
create = var.create && var.putin_khuylo
}
################################################################################ ################################################################################
# Cluster # Cluster
################################################################################ ################################################################################
resource "aws_eks_cluster" "this" { resource "aws_eks_cluster" "this" {
count = var.create ? 1 : 0 count = local.create ? 1 : 0
name = var.cluster_name name = var.cluster_name
role_arn = try(aws_iam_role.this[0].arn, var.iam_role_arn) role_arn = try(aws_iam_role.this[0].arn, var.iam_role_arn)
@@ -56,7 +60,7 @@ resource "aws_eks_cluster" "this" {
} }
resource "aws_cloudwatch_log_group" "this" { resource "aws_cloudwatch_log_group" "this" {
count = var.create && var.create_cloudwatch_log_group ? 1 : 0 count = local.create && var.create_cloudwatch_log_group ? 1 : 0
name = "/aws/eks/${var.cluster_name}/cluster" name = "/aws/eks/${var.cluster_name}/cluster"
retention_in_days = var.cloudwatch_log_group_retention_in_days retention_in_days = var.cloudwatch_log_group_retention_in_days
@@ -72,7 +76,7 @@ resource "aws_cloudwatch_log_group" "this" {
locals { locals {
cluster_sg_name = coalesce(var.cluster_security_group_name, "${var.cluster_name}-cluster") cluster_sg_name = coalesce(var.cluster_security_group_name, "${var.cluster_name}-cluster")
create_cluster_sg = var.create && var.create_cluster_security_group create_cluster_sg = local.create && var.create_cluster_security_group
cluster_security_group_id = local.create_cluster_sg ? aws_security_group.cluster[0].id : var.cluster_security_group_id cluster_security_group_id = local.create_cluster_sg ? aws_security_group.cluster[0].id : var.cluster_security_group_id
@@ -147,13 +151,13 @@ resource "aws_security_group_rule" "cluster" {
################################################################################ ################################################################################
data "tls_certificate" "this" { data "tls_certificate" "this" {
count = var.create && var.enable_irsa ? 1 : 0 count = local.create && var.enable_irsa ? 1 : 0
url = aws_eks_cluster.this[0].identity[0].oidc[0].issuer url = aws_eks_cluster.this[0].identity[0].oidc[0].issuer
} }
resource "aws_iam_openid_connect_provider" "oidc_provider" { resource "aws_iam_openid_connect_provider" "oidc_provider" {
count = var.create && var.enable_irsa ? 1 : 0 count = local.create && var.enable_irsa ? 1 : 0
client_id_list = distinct(compact(concat(["sts.${data.aws_partition.current.dns_suffix}"], var.openid_connect_audiences))) client_id_list = distinct(compact(concat(["sts.${data.aws_partition.current.dns_suffix}"], var.openid_connect_audiences)))
thumbprint_list = concat([data.tls_certificate.this[0].certificates[0].sha1_fingerprint], var.custom_oidc_thumbprints) thumbprint_list = concat([data.tls_certificate.this[0].certificates[0].sha1_fingerprint], var.custom_oidc_thumbprints)
@@ -170,7 +174,7 @@ resource "aws_iam_openid_connect_provider" "oidc_provider" {
################################################################################ ################################################################################
locals { locals {
create_iam_role = var.create && var.create_iam_role create_iam_role = local.create && var.create_iam_role
iam_role_name = coalesce(var.iam_role_name, "${var.cluster_name}-cluster") iam_role_name = coalesce(var.iam_role_name, "${var.cluster_name}-cluster")
policy_arn_prefix = "arn:${data.aws_partition.current.partition}:iam::aws:policy" policy_arn_prefix = "arn:${data.aws_partition.current.partition}:iam::aws:policy"
@@ -182,7 +186,7 @@ locals {
} }
data "aws_iam_policy_document" "assume_role_policy" { data "aws_iam_policy_document" "assume_role_policy" {
count = var.create && var.create_iam_role ? 1 : 0 count = local.create && var.create_iam_role ? 1 : 0
statement { statement {
sid = "EKSClusterAssumeRole" sid = "EKSClusterAssumeRole"
@@ -261,7 +265,7 @@ resource "aws_iam_policy" "cluster_encryption" {
################################################################################ ################################################################################
resource "aws_eks_addon" "this" { resource "aws_eks_addon" "this" {
for_each = { for k, v in var.cluster_addons : k => v if var.create } for_each = { for k, v in var.cluster_addons : k => v if local.create }
cluster_name = aws_eks_cluster.this[0].name cluster_name = aws_eks_cluster.this[0].name
addon_name = try(each.value.name, each.key) addon_name = try(each.value.name, each.key)
@@ -291,7 +295,7 @@ resource "aws_eks_addon" "this" {
################################################################################ ################################################################################
resource "aws_eks_identity_provider_config" "this" { resource "aws_eks_identity_provider_config" "this" {
for_each = { for k, v in var.cluster_identity_providers : k => v if var.create } for_each = { for k, v in var.cluster_identity_providers : k => v if local.create }
cluster_name = aws_eks_cluster.this[0].name cluster_name = aws_eks_cluster.this[0].name

View File

@@ -422,3 +422,9 @@ variable "eks_managed_node_group_defaults" {
type = any type = any
default = {} default = {}
} }
variable "putin_khuylo" {
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
type = bool
default = true
}