0
votes

For bill tracking purpose, given we have other solutions on AWS, we are asked to add a custom tag to all tagable resources created by Terraform AWS EKS, something like Tag key = "platform" tag value = "k8s". Practically a static tag that shows it is a kubernetes resource.

We are modeling our solution after this guide:

https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/eks-getting-started

It seems though as many resources on aws provider for eks on terraform do not provide the option for custom tags.

Is there any way we can get a custom tag across the board?

I'm still going through AWS EKS and Terraform AWS EKS guides but haven't been able that would help answer my question.

Any direction is highly appreciated!

Greg

2

2 Answers

2
votes

Try here: https://github.com/terraform-aws-modules/terraform-aws-eks

Under the inputs of "terraform-aws-eks" you can find "Tags" - A map of tags to add to all resources.

Good luck.

0
votes

What kind of custom tags you're looking for? If in case a Static tag. Modify the below AWS provided lambda function according to your need and add a hard coded value (key:value pair) inside the lambda function.

Look at this blog post, if you're looking for custom tags based on API calls. https://aws.amazon.com/blogs/security/how-to-automatically-tag-amazon-ec2-resources-in-response-to-api-events/