generated from terraform-modules/template_aws_submodules
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move cloudwatch agent to an addon (1.25+)
- Loading branch information
Showing
52 changed files
with
366 additions
and
2,827 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,3 +43,6 @@ | |
| - xray | ||
| - secrets-manager | ||
| - cloudwatch-agent | ||
|
|
||
| * 2.2.0 -- 2024-03-25 | ||
| - move cloudwatch agent to an addon | ||
66 changes: 66 additions & 0 deletions
66
examples/full-cluster-tf-upgrade/1.25/addons/addon_cloudwatch.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # https://docs.aws.amazon.com/eks/latest/userguide/eks-add-ons.html | ||
| # amazon-cloudwatch-observability | ||
|
|
||
| locals { | ||
| cloudwatch_managed_policies = ["AWSXrayWriteOnlyAccess", "CloudWatchAgentServerPolicy"] | ||
| cloudwatch_observability_name = "cloudwatch-agent" | ||
| cloudwatch_observability_namespace = "amazon-cloudwatch" | ||
| } | ||
|
|
||
| data "aws_iam_policy" "cloudwatch-observability-policies" { | ||
| for_each = toset(local.cloudwatch_managed_policies) | ||
| name = each.key | ||
| } | ||
|
|
||
| resource "aws_eks_addon" "amazon-cloudwatch-observability" { | ||
| count = lookup(local.addon_versions, "amazon-cloudwatch-observability", null) != null ? 1 : 0 | ||
|
|
||
| cluster_name = var.cluster_name | ||
| addon_name = "amazon-cloudwatch-observability" | ||
| addon_version = lookup(local.addon_versions, "amazon-cloudwatch-observability") | ||
| service_account_role_arn = module.role_cloudwatch-observability.iam_role_arn | ||
| configuration_values = null | ||
| # resolve_conflicts = "OVERWRITE" | ||
| # note OVERWRITE resets to eks addon defaults, PRESERVE uses any values set here | ||
| resolve_conflicts_on_create = "OVERWRITE" | ||
| resolve_conflicts_on_update = "OVERWRITE" | ||
|
|
||
| depends_on = [aws_cloudwatch_log_group.cloudwatch-observability] | ||
| } | ||
|
|
||
| module "role_cloudwatch-observability" { | ||
| source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks" | ||
|
|
||
| role_description = "EKS IAM Role for ${var.cluster_name} for service account ${local.cloudwatch_observability_namespace}:${local.cloudwatch_observability_name}" | ||
| role_name = format("%v%v-irsa__%v", local._prefixes["eks-role"], var.cluster_name, local.cloudwatch_observability_name) | ||
| role_policy_arns = { for k, v in data.aws_iam_policy.cloudwatch-observability-policies : k => v.arn } | ||
|
|
||
| oidc_providers = { | ||
| main = { | ||
| provider_arn = local.oidc_provider_arn | ||
| namespace_service_accounts = [format("%v:%v", local.cloudwatch_observability_namespace, local.cloudwatch_observability_name)] | ||
| } | ||
| } | ||
|
|
||
| tags = merge( | ||
| local.base_tags, | ||
| local.common_tags, | ||
| var.application_tags, | ||
| { | ||
| "eks:namespace" = local.cloudwatch_observability_namespace | ||
| "eks:user" = local.cloudwatch_observability_name | ||
| } | ||
| ) | ||
| } | ||
|
|
||
| resource "aws_cloudwatch_log_group" "cloudwatch-observability" { | ||
| for_each = toset(var.cloudwatch-observability_log_names) | ||
| name = format("/aws/containerinsights/%v/%v", var.cluster_name, each.key) | ||
| retention_in_days = var.cloudwatch-observability_log_retention_days | ||
|
|
||
| tags = merge( | ||
| local.base_tags, | ||
| local.common_tags, | ||
| var.application_tags, | ||
| ) | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
examples/full-cluster-tf-upgrade/1.25/common-services/cloudwatch-agent/.tf-control
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
examples/full-cluster-tf-upgrade/1.25/common-services/cloudwatch-agent/.tf-control.tfrc
This file was deleted.
Oops, something went wrong.
127 changes: 0 additions & 127 deletions
127
examples/full-cluster-tf-upgrade/1.25/common-services/cloudwatch-agent/README.md
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.