Skip to content

Commit

Permalink
Update Terraform cn-terraform/cloudwatch-logs/aws to v1.0.11 (#56)
Browse files Browse the repository at this point in the history
* Update Terraform cn-terraform/cloudwatch-logs/aws to v1.0.11

* Fix pipeline

* Fix pipeline

* Add CW encryption variables

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Julian Nonino <[email protected]>
  • Loading branch information
renovate[bot] and jnonino authored Jun 28, 2022
1 parent bfeabc6 commit caab8aa
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 82 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
types: [opened, reopened, synchronize]
branches: [main]

env:
DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: localstack
AWS_SECRET_ACCESS_KEY: localstack

jobs:
check-format:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -40,6 +45,13 @@ jobs:
matrix: {
dir: ['examples/test']
}
services:
localstack:
image: localstack/localstack
env:
SERVICES: apigateway,cloudformation,cloudwatch,dynamodb,es,firehose,iam,kinesis,lambda,route53,redshift,s3,secretsmanager,ses,sns,sqs,ssm,stepfunctions,sts
ports:
- 4566:4566
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
56 changes: 27 additions & 29 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ In order to run all checks at any point run the following command:

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 |
| <a name="provider_random"></a> [random](#provider\_random) | 3.2.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.20.1 |
| <a name="provider_random"></a> [random](#provider\_random) | 3.3.2 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 4.0 |
| <a name="module_aws_cw_logs"></a> [aws\_cw\_logs](#module\_aws\_cw\_logs) | cn-terraform/cloudwatch-logs/aws | 1.0.10 |
| <a name="module_aws_cw_logs"></a> [aws\_cw\_logs](#module\_aws\_cw\_logs) | cn-terraform/cloudwatch-logs/aws | 1.0.11 |
| <a name="module_ecs_fargate"></a> [ecs\_fargate](#module\_ecs\_fargate) | cn-terraform/ecs-fargate/aws | 2.0.42 |

## Resources
Expand All @@ -70,6 +70,7 @@ In order to run all checks at any point run the following command:
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_block_s3_bucket_public_access"></a> [block\_s3\_bucket\_public\_access](#input\_block\_s3\_bucket\_public\_access) | (Optional) If true, public access to the S3 bucket will be blocked. | `bool` | `true` | no |
| <a name="input_create_kms_key"></a> [create\_kms\_key](#input\_create\_kms\_key) | If true a new KMS key will be created to encrypt the logs. Defaults true. If set to false a custom key can be used by setting the variable `log_group_kms_key_id` | `bool` | `false` | no |
| <a name="input_db_engine_version"></a> [db\_engine\_version](#input\_db\_engine\_version) | DB engine version | `string` | `"14.2"` | no |
| <a name="input_db_instance_size"></a> [db\_instance\_size](#input\_db\_instance\_size) | DB instance size | `string` | `"db.r4.large"` | no |
| <a name="input_db_name"></a> [db\_name](#input\_db\_name) | Default DB name | `string` | `"sonar"` | no |
Expand All @@ -86,6 +87,8 @@ In order to run all checks at any point run the following command:
| <a name="input_lb_enable_cross_zone_load_balancing"></a> [lb\_enable\_cross\_zone\_load\_balancing](#input\_lb\_enable\_cross\_zone\_load\_balancing) | Enable cross zone support for LB | `string` | `"true"` | no |
| <a name="input_lb_http_ports"></a> [lb\_http\_ports](#input\_lb\_http\_ports) | Map containing objects to define listeners behaviour based on type field. If type field is `forward`, include listener\_port and the target\_group\_port. For `redirect` type, include listener port, host, path, port, protocol, query and status\_code. For `fixed-response`, include listener\_port, content\_type, message\_body and status\_code | `map(any)` | `{}` | no |
| <a name="input_lb_https_ports"></a> [lb\_https\_ports](#input\_lb\_https\_ports) | Map containing objects to define listeners behaviour based on type field. If type field is `forward`, include listener\_port and the target\_group\_port. For `redirect` type, include listener port, host, path, port, protocol, query and status\_code. For `fixed-response`, include listener\_port, content\_type, message\_body and status\_code | `map(any)` | <pre>{<br> "default": {<br> "listener_port": 443,<br> "target_group_port": 9000,<br> "target_group_protocol": "HTTP"<br> }<br>}</pre> | no |
| <a name="input_log_group_kms_key_id"></a> [log\_group\_kms\_key\_id](#input\_log\_group\_kms\_key\_id) | The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested. | `string` | `null` | no |
| <a name="input_log_group_retention_in_days"></a> [log\_group\_retention\_in\_days](#input\_log\_group\_retention\_in\_days) | (Optional) Specifies the number of days you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0. If you select 0, the events in the log group are always retained and never expire. Default to 30 days. | `number` | `30` | no |
| <a name="input_mount_points"></a> [mount\_points](#input\_mount\_points) | Container mount points. This is a list of maps, where each map should contain a `containerPath` and `sourceVolume`. The `readOnly` key is optional. | `list(any)` | `[]` | no |
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | Name prefix for resources on AWS | `string` | n/a | yes |
| <a name="input_private_subnets_ids"></a> [private\_subnets\_ids](#input\_private\_subnets\_ids) | List of Private Subnets IDs | `list(string)` | n/a | yes |
Expand Down
90 changes: 45 additions & 45 deletions examples/test/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 22 additions & 2 deletions examples/test/mock_provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ provider "aws" {
skip_requesting_account_id = true
skip_metadata_api_check = true
s3_use_path_style = true
access_key = "mock_access_key"
secret_key = "mock_secret_key"

endpoints {
apigateway = "http://localstack:4566"
cloudformation = "http://localstack:4566"
cloudwatch = "http://localstack:4566"
dynamodb = "http://localstack:4566"
es = "http://localstack:4566"
firehose = "http://localstack:4566"
iam = "http://localstack:4566"
kinesis = "http://localstack:4566"
lambda = "http://localstack:4566"
route53 = "http://localstack:4566"
redshift = "http://localstack:4566"
s3 = "http://localstack:4566"
secretsmanager = "http://localstack:4566"
ses = "http://localstack:4566"
sns = "http://localstack:4566"
sqs = "http://localstack:4566"
ssm = "http://localstack:4566"
stepfunctions = "http://localstack:4566"
sts = "http://localstack:4566"
}
}
10 changes: 7 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ resource "random_password" "master_password" {
#------------------------------------------------------------------------------
module "aws_cw_logs" {
source = "cn-terraform/cloudwatch-logs/aws"
version = "1.0.10"
version = "1.0.11"
# source = "../terraform-aws-cloudwatch-logs"

logs_path = "/ecs/service/${var.name_prefix}-sonar"
tags = var.tags
create_kms_key = var.create_kms_key
log_group_kms_key_id = var.log_group_kms_key_id
log_group_retention_in_days = var.log_group_retention_in_days
logs_path = "/ecs/service/${var.name_prefix}-jenkins-master"

tags = var.tags
}

#------------------------------------------------------------------------------
Expand Down
21 changes: 21 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,27 @@ variable "lb_https_ports" {
}
}

#------------------------------------------------------------------------------
# CloudWatch logs
#------------------------------------------------------------------------------
variable "create_kms_key" {
description = "If true a new KMS key will be created to encrypt the logs. Defaults true. If set to false a custom key can be used by setting the variable `log_group_kms_key_id`"
type = bool
default = false
}

variable "log_group_kms_key_id" {
description = "The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested."
type = string
default = null
}

variable "log_group_retention_in_days" {
description = "(Optional) Specifies the number of days you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0. If you select 0, the events in the log group are always retained and never expire. Default to 30 days."
type = number
default = 30
}

#------------------------------------------------------------------------------
# APPLICATION LOAD BALANCER LOGS
#------------------------------------------------------------------------------
Expand Down

0 comments on commit caab8aa

Please sign in to comment.