Skip to content

Commit 9af36fd

Browse files
CA-132 - Fix ES log group implementation (#22)
* Updates version to merge new release. * Adds new empty line. * Updates changelog. * Accomodates examples and fixes example errors. * Runs lint and docs.
1 parent 66eee60 commit 9af36fd

File tree

8 files changed

+30
-9
lines changed

8 files changed

+30
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Tamr Terraform AWS Elasticsearch Repo
22

3+
## v4.0.0 - November 15th 2021
4+
* Replaces`logs_retention_in_days` for `log_group_name` variable for cloudwatch-logs module.
5+
* Replaces the creation of a cloudwatch log group for a data source query to get an existent log group for use.
6+
37
## v3.1.0 - November 15th 2021
48
* Adds variables `logs_retention_in_days` and `log_types` that enables the publishing of ElasticSearch Logs into CloudWatch
59

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This module creates:
3636
| Name | Version |
3737
|------|---------|
3838
| terraform | >= 0.13 |
39-
| aws | >= 3.36.0 |
39+
| aws | >= 3.36.0, < 4.0.0 |
4040

4141
## Providers
4242

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.0
1+
4.0.0

examples/logs/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ No requirements.
1313

1414
| Name | Description | Type | Default | Required |
1515
|------|-------------|------|---------|:--------:|
16+
| ingress\_cidr\_blocks | n/a | `list(string)` | n/a | yes |
1617
| name-prefix | A string to prepend to names of resources created by this example | `any` | n/a | yes |
18+
| subnet\_cidr | n/a | `string` | n/a | yes |
19+
| vpc\_cidr | n/a | `string` | n/a | yes |
1720
| create\_new\_service\_role | Whether to create a new IAM service linked role for ES. This only needs to happen once per account. If false, linked\_service\_role is required | `bool` | `false` | no |
1821
| log\_retention\_in\_days | Specifies the number of days you want to retain log events.<br> Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0.<br> If you select 0, the events in the log group are always retained and never expire. | `number` | `0` | no |
1922
| log\_types | A list of log types that will be published to CloudWatch. Valid values are SEARCH\_SLOW\_LOGS, INDEX\_SLOW\_LOGS, ES\_APPLICATION\_LOGS and AUDIT\_LOGS. | `list(string)` | <pre>[<br> "ES_APPLICATION_LOGS",<br> "SEARCH_SLOW_LOGS",<br> "INDEX_SLOW_LOGS"<br>]</pre> | no |

examples/logs/main.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ module "sg-ports" {
1414
source = "../../modules/es-ports"
1515
}
1616

17-
1817
module "aws-sg" {
1918
source = "git::[email protected]:Datatamer/terraform-aws-security-groups.git?ref=0.1.0"
2019
vpc_id = aws_vpc.es_vpc.id
@@ -33,7 +32,10 @@ resource "aws_iam_service_linked_role" "es" {
3332
}
3433

3534
module "tamr-es-cluster" {
36-
depends_on = [aws_iam_service_linked_role.es]
35+
depends_on = [
36+
aws_iam_service_linked_role.es,
37+
aws_cloudwatch_log_group.es-logs
38+
]
3739
source = "../../"
3840
vpc_id = aws_vpc.es_vpc.id
3941
domain_name = format("%s-elasticsearch", var.name-prefix)
@@ -46,7 +48,7 @@ module "tamr-es-cluster" {
4648

4749
#tfsec:ignore:aws-cloudwatch-log-group-customer-key
4850
resource "aws_cloudwatch_log_group" "es-logs" {
49-
name_prefix = format("%s-%s", var.name-prefix, "example-logs")
51+
name = format("%s-%s", var.name-prefix, "example-logs")
5052

5153
retention_in_days = var.log_retention_in_days
5254
tags = var.tags

examples/logs/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,15 @@ variable "log_retention_in_days" {
3232
EOF
3333
default = 0
3434
}
35+
36+
variable "vpc_cidr" {
37+
type = string
38+
}
39+
40+
variable "subnet_cidr" {
41+
type = string
42+
}
43+
44+
variable "ingress_cidr_blocks" {
45+
type = list(string)
46+
}

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ module "tamr-es-cluster" {
2222
tls_security_policy = var.tls_security_policy
2323
node_to_node_encryption_enabled = var.node_to_node_encryption_enabled
2424
arn_partition = var.arn_partition
25-
log_publishing_options = module.tamr-es-coudwatch-log-groups.log_publishing_options
25+
log_publishing_options = module.tamr-es-cloudwatch-log-groups.log_publishing_options
2626

2727
depends_on = [
28-
module.tamr-es-coudwatch-log-groups
28+
module.tamr-es-cloudwatch-log-groups
2929
]
3030
}
3131

32-
module "tamr-es-coudwatch-log-groups" {
32+
module "tamr-es-cloudwatch-log-groups" {
3333
source = "./modules/cloudwatch-logs"
3434

3535
domain_name = var.domain_name

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
terraform {
22
required_version = ">= 0.13"
33
required_providers {
4-
aws = ">= 3.36.0"
4+
aws = ">= 3.36.0, < 4.0.0"
55
}
66
}

0 commit comments

Comments
 (0)