Skip to content

Commit

Permalink
feat: Add tags to EKS created cluster security group to match rest of…
Browse files Browse the repository at this point in the history
… module tagging scheme (terraform-aws-modules#1957)
  • Loading branch information
bryantbiggs authored Mar 24, 2022
1 parent ca7854a commit 9371a29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ Full contributing [guidelines are covered here](https://github.com/terraform-aws
| Name | Type |
|------|------|
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_ec2_tag.cluster_primary_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_tag) | resource |
| [aws_eks_addon.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_addon) | resource |
| [aws_eks_cluster.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_cluster) | resource |
| [aws_eks_identity_provider_config.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_identity_provider_config) | resource |
Expand Down
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ resource "aws_eks_cluster" "this" {
]
}

resource "aws_ec2_tag" "cluster_primary_security_group" {
for_each = { for k, v in merge(var.tags, var.cluster_tags) : k => v if var.create }

resource_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
key = each.key
value = each.value
}

resource "aws_cloudwatch_log_group" "this" {
count = local.create && var.create_cloudwatch_log_group ? 1 : 0

Expand Down

0 comments on commit 9371a29

Please sign in to comment.