Skip to content

Commit

Permalink
feat: Add variable for applying tags to the log_forwarder bucket (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1aki authored Aug 28, 2024
1 parent 3920c11 commit 37701a0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| <a name="input_kms_alias"></a> [kms\_alias](#input\_kms\_alias) | Alias of KMS key used to encrypt the Datadog API keys - must start with `alias/` | `string` | n/a | yes |
| <a name="input_log_forwarder_architectures"></a> [log\_forwarder\_architectures](#input\_log\_forwarder\_architectures) | Instruction set architecture for your Lambda function. Valid values are `["x86_64"]` and `["arm64"]`. Default is `["x86_64"]` | `list(string)` | <pre>[<br> "x86_64"<br>]</pre> | no |
| <a name="input_log_forwarder_bucket_prefix"></a> [log\_forwarder\_bucket\_prefix](#input\_log\_forwarder\_bucket\_prefix) | S3 object key prefix to prepend to zip archive name | `string` | `""` | no |
| <a name="input_log_forwarder_bucket_tags"></a> [log\_forwarder\_bucket\_tags](#input\_log\_forwarder\_bucket\_tags) | A map of tags to apply to the log forwarder bucket | `map(any)` | `{}` | no |
| <a name="input_log_forwarder_environment_variables"></a> [log\_forwarder\_environment\_variables](#input\_log\_forwarder\_environment\_variables) | A map of environment variables for the log forwarder lambda function | `map(string)` | `{}` | no |
| <a name="input_log_forwarder_kms_key_arn"></a> [log\_forwarder\_kms\_key\_arn](#input\_log\_forwarder\_kms\_key\_arn) | KMS key that is used to encrypt environment variables. If this configuration is not provided when environment variables are in use, AWS Lambda uses a default service key | `string` | `null` | no |
| <a name="input_log_forwarder_lambda_tags"></a> [log\_forwarder\_lambda\_tags](#input\_log\_forwarder\_lambda\_tags) | A map of tags to apply to the log forwarder lambda function | `map(string)` | `{}` | no |
Expand Down
1 change: 1 addition & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ module "default" {
log_forwarder_role_tags = { ForwarderRole = true }
log_forwarder_s3_log_bucket_arns = [module.log_bucket_1.s3_bucket_arn, module.log_bucket_2.s3_bucket_arn]
log_forwarder_tags = { LogForwarder = true }
log_forwarder_bucket_tags = { ForwarderBucket = true }

rds_em_forwarder_name = "complete-datadog-rds-forwarder"
rds_em_forwarder_memory_size = 512
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module "log_forwarder" {
create_bucket = var.create_bucket
bucket_name = var.bucket_name
bucket_prefix = var.log_forwarder_bucket_prefix
bucket_tags = var.log_forwarder_bucket_tags
bucket_attach_deny_insecure_transport_policy = var.bucket_attach_deny_insecure_transport_policy
bucket_encryption_settings = var.bucket_encryption_settings

Expand Down
1 change: 1 addition & 0 deletions modules/log_forwarder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ module "datadog_log_forwarder" {
| <a name="input_bucket_encryption_settings"></a> [bucket\_encryption\_settings](#input\_bucket\_encryption\_settings) | S3 bucket server side encryption settings | `map(string)` | <pre>{<br> "sse_algorithm": "AES256"<br>}</pre> | no |
| <a name="input_bucket_name"></a> [bucket\_name](#input\_bucket\_name) | Forwarder S3 bucket name | `string` | `""` | no |
| <a name="input_bucket_prefix"></a> [bucket\_prefix](#input\_bucket\_prefix) | S3 object key prefix to prepend to zip archive name | `string` | `""` | no |
| <a name="input_bucket_tags"></a> [bucket\_tags](#input\_bucket\_tags) | A map of tags to apply to the bucket | `map(string)` | `{}` | no |
| <a name="input_create"></a> [create](#input\_create) | Controls whether the forwarder resources should be created | `bool` | `true` | no |
| <a name="input_create_bucket"></a> [create\_bucket](#input\_create\_bucket) | Controls whether an S3 bucket should be created for the forwarder | `bool` | `true` | no |
| <a name="input_create_role"></a> [create\_role](#input\_create\_role) | Controls whether an IAM role is created for the forwarder | `bool` | `true` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/log_forwarder/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module "this_s3_bucket" {
}
}

tags = var.tags
tags = merge(var.tags, var.bucket_tags)
}

################################################################################
Expand Down
6 changes: 6 additions & 0 deletions modules/log_forwarder/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ variable "bucket_prefix" {
default = ""
}

variable "bucket_tags" {
description = "A map of tags to apply to the bucket"
type = map(string)
default = {}
}

variable "s3_zip_storage_class" {
description = "Specifies the desired Storage Class for the zip object. Can be either `STANDARD`, `REDUCED_REDUNDANCY`, `ONEZONE_IA`, `INTELLIGENT_TIERING`, or `STANDARD_IA`"
type = string
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ variable "log_forwarder_bucket_prefix" {
default = ""
}

variable "log_forwarder_bucket_tags" {
description = "A map of tags to apply to the log forwarder bucket"
type = map(any)
default = {}
}

variable "log_forwarder_s3_zip_storage_class" {
description = "Specifies the desired Storage Class for the zip object. Can be either `STANDARD`, `REDUCED_REDUNDANCY`, `ONEZONE_IA`, `INTELLIGENT_TIERING`, or `STANDARD_IA`"
type = string
Expand Down

0 comments on commit 37701a0

Please sign in to comment.