Skip to content

Commit

Permalink
fix: Update CloudWatch Observability permissions and add to example/R…
Browse files Browse the repository at this point in the history
…EADME
  • Loading branch information
bryantbiggs committed Mar 18, 2024
1 parent ffc8ede commit b75e8de
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ module "cert_manager_pod_identity" {
}
```

### [AWS CloudWatch Observability](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Observability-EKS-addon.html)

```hcl
module "aws_cloudwatch_observability_pod_identity" {
source = "terraform-aws-modules/eks-pod-identity/aws"
name = "aws-cloudwatch-observability"
attach_aws_cloudwatch_observability_policy = true
tags = {
Environment = "dev"
}
}
```


### [Cluster Autoscaler](https://github.com/kubernetes/autoscaler)

```hcl
Expand Down
7 changes: 5 additions & 2 deletions aws_cloudwatch_observability.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
################################################################################

resource "aws_iam_role_policy_attachment" "aws_cloudwatch_observability" {
count = var.create && var.attach_aws_cloudwatch_observability_policy ? 1 : 0
for_each = { for k, v in {
CloudWatchAgentServerPolicy = "arn:${local.partition}:iam::aws:policy/CloudWatchAgentServerPolicy"
AWSXrayWriteOnlyAccess = "arn:${local.partition}:iam::aws:policy/AWSXrayWriteOnlyAccess"
} : k => v if var.create && var.attach_aws_cloudwatch_observability_policy }

role = aws_iam_role.this[0].name
policy_arn = "arn:${local.partition}:iam::aws:policy/CloudWatchAgentServerPolicy"
policy_arn = each.value
}
1 change: 1 addition & 0 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Note that this example may create resources which will incur monetary charges on
| <a name="module_amazon_managed_service_prometheus_pod_identity"></a> [amazon\_managed\_service\_prometheus\_pod\_identity](#module\_amazon\_managed\_service\_prometheus\_pod\_identity) | ../../ | n/a |
| <a name="module_aws_appmesh_controller_pod_identity"></a> [aws\_appmesh\_controller\_pod\_identity](#module\_aws\_appmesh\_controller\_pod\_identity) | ../../ | n/a |
| <a name="module_aws_appmesh_envoy_proxy_pod_identity"></a> [aws\_appmesh\_envoy\_proxy\_pod\_identity](#module\_aws\_appmesh\_envoy\_proxy\_pod\_identity) | ../../ | n/a |
| <a name="module_aws_cloudwatch_observability_pod_identity"></a> [aws\_cloudwatch\_observability\_pod\_identity](#module\_aws\_cloudwatch\_observability\_pod\_identity) | ../../ | n/a |
| <a name="module_aws_ebs_csi_pod_identity"></a> [aws\_ebs\_csi\_pod\_identity](#module\_aws\_ebs\_csi\_pod\_identity) | ../../ | n/a |
| <a name="module_aws_efs_csi_pod_identity"></a> [aws\_efs\_csi\_pod\_identity](#module\_aws\_efs\_csi\_pod\_identity) | ../../ | n/a |
| <a name="module_aws_fsx_lustre_csi_pod_identity"></a> [aws\_fsx\_lustre\_csi\_pod\_identity](#module\_aws\_fsx\_lustre\_csi\_pod\_identity) | ../../ | n/a |
Expand Down
10 changes: 10 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ module "cert_manager_pod_identity" {
tags = local.tags
}

module "aws_cloudwatch_observability_pod_identity" {
source = "../../"

name = "aws-cloudwatch-observability"

attach_aws_cloudwatch_observability_policy = true

tags = local.tags
}

module "cluster_autoscaler_pod_identity" {
source = "../../"

Expand Down

0 comments on commit b75e8de

Please sign in to comment.