Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cloudwatch log class functionality #242

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add cloudwatch log class functionality
richardgavel-ordinaryexperts committed Nov 13, 2024
commit b1e5be8ecd61e3bd808e1b2cfa5207acd7fac298
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -184,6 +184,7 @@ No resources.
| <a name="input_autoscaling_capacity_providers"></a> [autoscaling\_capacity\_providers](#input\_autoscaling\_capacity\_providers) | Map of autoscaling capacity provider definitions to create for the cluster | `any` | `{}` | no |
| <a name="input_cloudwatch_log_group_kms_key_id"></a> [cloudwatch\_log\_group\_kms\_key\_id](#input\_cloudwatch\_log\_group\_kms\_key\_id) | If a KMS Key ARN is set, this key will be used to encrypt the corresponding log group. Please be sure that the KMS Key has an appropriate key policy (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html) | `string` | `null` | no |
| <a name="input_cloudwatch_log_group_name"></a> [cloudwatch\_log\_group\_name](#input\_cloudwatch\_log\_group\_name) | Custom name of CloudWatch Log Group for ECS cluster | `string` | `null` | no |
| <a name="input_cloudwatch_log_group_log_group_class"></a> [cloudwatch\_log\_group\_log\_group\_class](#input\_cloudwatch\_log\_group\_log\_group\_class) | Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT_ACCESS. Default is STANDARD | `string` | `STANDARD` | no |
| <a name="input_cloudwatch_log_group_retention_in_days"></a> [cloudwatch\_log\_group\_retention\_in\_days](#input\_cloudwatch\_log\_group\_retention\_in\_days) | Number of days to retain log events | `number` | `90` | no |
| <a name="input_cloudwatch_log_group_tags"></a> [cloudwatch\_log\_group\_tags](#input\_cloudwatch\_log\_group\_tags) | A map of additional tags to add to the log group created | `map(string)` | `{}` | no |
| <a name="input_cluster_configuration"></a> [cluster\_configuration](#input\_cluster\_configuration) | The execute command configuration for the cluster | `any` | `{}` | no |
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
2 changes: 1 addition & 1 deletion examples/ec2-autoscaling/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
2 changes: 1 addition & 1 deletion examples/fargate/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
2 changes: 1 addition & 1 deletion modules/cluster/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
1 change: 1 addition & 0 deletions modules/container-definition/main.tf
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ resource "aws_cloudwatch_log_group" "this" {

name = var.cloudwatch_log_group_use_name_prefix ? null : local.log_group_name
name_prefix = var.cloudwatch_log_group_use_name_prefix ? "${local.log_group_name}-" : null
log_group_class = var.cloudwatch_log_group_log_group_class
retention_in_days = var.cloudwatch_log_group_retention_in_days
kms_key_id = var.cloudwatch_log_group_kms_key_id

6 changes: 6 additions & 0 deletions modules/container-definition/variables.tf
Original file line number Diff line number Diff line change
@@ -304,6 +304,12 @@ variable "cloudwatch_log_group_use_name_prefix" {
default = false
}

variable "cloudwatch_log_group_log_group_class" {
description = "Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT_ACCESS. Default is STANDARD"
type = string
default = "STANDARD"
}

variable "cloudwatch_log_group_retention_in_days" {
description = "Number of days to retain log events. Default is 30 days"
type = number
2 changes: 1 addition & 1 deletion modules/container-definition/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
1 change: 1 addition & 0 deletions modules/service/main.tf
Original file line number Diff line number Diff line change
@@ -580,6 +580,7 @@ module "container_definition" {
create_cloudwatch_log_group = try(each.value.create_cloudwatch_log_group, var.container_definition_defaults.create_cloudwatch_log_group, true)
cloudwatch_log_group_name = try(each.value.cloudwatch_log_group_name, var.container_definition_defaults.cloudwatch_log_group_name, null)
cloudwatch_log_group_use_name_prefix = try(each.value.cloudwatch_log_group_use_name_prefix, var.container_definition_defaults.cloudwatch_log_group_use_name_prefix, false)
cloudwatch_log_group_log_group_class = try(each.value.cloudwatch_log_group_log_group_class, var.container_definition_defaults.cloudwatch_log_group_log_group_class, "STANDARD")
cloudwatch_log_group_retention_in_days = try(each.value.cloudwatch_log_group_retention_in_days, var.container_definition_defaults.cloudwatch_log_group_retention_in_days, 14)
cloudwatch_log_group_kms_key_id = try(each.value.cloudwatch_log_group_kms_key_id, var.container_definition_defaults.cloudwatch_log_group_kms_key_id, null)

2 changes: 1 addition & 1 deletion modules/service/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -65,6 +65,12 @@ variable "cloudwatch_log_group_name" {
default = null
}

variable "cloudwatch_log_group_log_group_class" {
description = "Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT_ACCESS. Default is STANDARD"
type = string
default = "STANDARD"
}

variable "cloudwatch_log_group_retention_in_days" {
description = "Number of days to retain log events"
type = number
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
2 changes: 1 addition & 1 deletion wrappers/cluster/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
1 change: 1 addition & 0 deletions wrappers/container-definition/main.tf
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ module "wrapper" {
for_each = var.items

cloudwatch_log_group_kms_key_id = try(each.value.cloudwatch_log_group_kms_key_id, var.defaults.cloudwatch_log_group_kms_key_id, null)
cloudwatch_log_group_log_group_class = try(each.value.cloudwatch_log_group_log_group_class, var.defaults.cloudwatch_log_group_log_group_class, "STANDARD")
cloudwatch_log_group_name = try(each.value.cloudwatch_log_group_name, var.defaults.cloudwatch_log_group_name, null)
cloudwatch_log_group_retention_in_days = try(each.value.cloudwatch_log_group_retention_in_days, var.defaults.cloudwatch_log_group_retention_in_days, 30)
cloudwatch_log_group_use_name_prefix = try(each.value.cloudwatch_log_group_use_name_prefix, var.defaults.cloudwatch_log_group_use_name_prefix, false)
2 changes: 1 addition & 1 deletion wrappers/container-definition/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}
2 changes: 1 addition & 1 deletion wrappers/versions.tf
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.30.0"
}
}
}