Skip to content
This repository was archived by the owner on Dec 29, 2021. It is now read-only.

Commit 67072a5

Browse files
committed
Update README.md
1 parent 4a12e28 commit 67072a5

File tree

2 files changed

+48
-18
lines changed

2 files changed

+48
-18
lines changed

README.md

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# Kubernetes Tagging Lambda
1+
# AWS Tagging Lambda
22

3-
When you operate Kubernetes cluster, you will sooner or later create some additional resources like volumes or load balancers. You might need to attach some tags to these resources. This repository contains installation of AWS Lambda function which will go through all your resources, identify them based on tag `KubernetesCluster` tag which should contain the name of your Kubernetes cluster. For every resource it find it will make sure that the desiredßß tags are attached.
3+
When you operate complex applications in AWS, you will sooner or later create some additional resources like volumes or load balancers. You might need to attach some tags to these resources. This repository contains installation of AWS Lambda function which will go through all your resources, identify them based on a configured tag which should contain ta specific value. For every resource it find it will make sure that the desired tags are attached.
44

55
<!-- TOC -->
66

7-
- [Kubernetes Tagging Lambda](#kubernetes-tagging-lambda)
7+
- [AWS Tagging Lambda](#aws-tagging-lambda)
88
- [Prerequisites and dependencies](#prerequisites-and-dependencies)
9-
- [Configuration](#configuration)
10-
- [Deploying tagging lambda](#deploying-tagging-lambda)
11-
- [Deleting tagging lambda](#deleting-tagging-lambda)
9+
- [Tagging Kubernetes clusters](#tagging-kubernetes-clusters)
10+
- [Using as standalone Terraform configuration](#using-as-standalone-terraform-configuration)
11+
- [Deploying tagging lambda](#deploying-tagging-lambda)
12+
- [Deleting tagging lambda](#deleting-tagging-lambda)
13+
- [Using as a Terraform module](#using-as-a-terraform-module)
1214
- [Tagged resources](#tagged-resources)
1315

1416
<!-- /TOC -->
@@ -19,26 +21,33 @@ When you operate Kubernetes cluster, you will sooner or later create some additi
1921
* Generating of the lambda function from the template and packing it into ZIP archive expects `bash` and `zip` being available.
2022
* This deployment might not work on Windows machine. Tested only on Linux and macOS
2123

22-
## Configuration
24+
## Tagging Kubernetes clusters
25+
26+
This Lambda fucntion was originally developed for tagging Kubernetes cluster and their resources. But it should work with other applications as well.
27+
28+
## Using as standalone Terraform configuration
2329

2430
The configuration is done through Terraform variables. Example *tfvars* file is part of this repo and is named `example.tfvars`. Change the variables to match your environment / requirements before running `terraform apply ...`.
2531

2632
| Option | Explanation | Example |
2733
|--------|-------------|---------|
2834
| `aws_region` | AWS region which should be used | `eu-central-1` |
29-
| `cluster_name` | Name of the Kubernetes cluster (used to find the resources for tagging but also to name resources created by this configuration) | `my-minikube` |
35+
| `name` | Name of the Kubernetes cluster (used to find the resources for tagging but also to name resources created by this configuration) | `my-minikube` |
36+
| `search_tag_key` | The Key of the tag which determines resources belonging to the application. All resources with matching tag and its value will be tagged with additional tags. | `kubernetes.io/cluster/aws-k8s` |
37+
| `search_tag_value` | The Valur of the tag which determines resources belonging to the application. All resources with matching tag and its value will be tagged with additional tags. | `owned` |
3038
| `tags` | Tags which should be applied to all resources | `{ Hello = "World" }` |
3139

32-
## Deploying tagging lambda
40+
### Deploying tagging lambda
3341

3442
To deploy the tagging lambda,
3543
* Export AWS credentials into environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
3644
* Apply Terraform configuration with tagging lambda:
3745
```bash
46+
terraform init
3847
terraform apply --var-file example.tfvars
3948
```
4049

41-
## Deleting tagging lambda
50+
### Deleting tagging lambda
4251

4352
To delete tagging lambda,
4453
* Export AWS credentials into environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
@@ -47,17 +56,38 @@ To delete tagging lambda,
4756
terraform destroy --var-file example.tfvars
4857
```
4958

59+
## Using as a Terraform module
60+
61+
Although it can be run on its own, the main value is that it can be included into another Terraform configuration.
62+
63+
```hcl
64+
module "tagging-lambda" {
65+
source = "scholzj/tagging-lambda/aws"
66+
67+
aws_region = "eu-east-1"
68+
name = "my-application"
69+
search_tag_key = "kubernetes.io/cluster/aws-k8s"
70+
search_tag_value = "owned"
71+
72+
# Tags
73+
tags = {
74+
Hello = "World"
75+
}
76+
}
77+
```
78+
79+
An example of how to include this can be found in the [examples](examples/) dir.
5080
## Tagged resources
5181

5282
* EC2 instances
5383
* Network interfaces
5484
* EBS Volumes
5585
* Security Groups
56-
* Internet Gateways (*not applicable in ProductDev*)
57-
* DHCP Option sets (*not applicable in ProductDev*)
58-
* Subnets (*not applicable in ProductDev*)
59-
* Route tables (*not applicable in ProductDev*)
60-
* VPCs (*not applicable in ProductDev*)
61-
* Network ACLs (*not applicable in ProductDev*)
86+
* Internet Gateways
87+
* DHCP Option sets
88+
* Subnets
89+
* Route tables
90+
* VPCs
91+
* Network ACLs
6292
* Autoscaling Groups
6393
* Elastic Loadbalancers

example.tfvars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
aws_region = "eu-east-1"
22

33
# Used for naming related resources
4-
name = "my-minikube"
4+
name = "my-k8s"
55

66
# The Key of the tag which determines resources belonging to the application. All resources with matching tag and its value will be tagged with additional tags.
7-
search_tag_key = "kubernetes.io/cluster/my-minikube"
7+
search_tag_key = "kubernetes.io/cluster/my-k8s"
88
search_tag_value = "owned"
99

1010
# Tags

0 commit comments

Comments
 (0)