Skip to content

Commit c18861e

Browse files
srouaixSébastien Rouaixantonbabenko
authored
feat: Add enhanced_metrics_config (#68)
Co-authored-by: Sébastien Rouaix <sebastien-externe.rouaix@edf.fr> Co-authored-by: Anton Babenko <anton@antonbabenko.com>
1 parent c429860 commit c18861e

File tree

8 files changed

+29
-5
lines changed

8 files changed

+29
-5
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.96.1
3+
rev: v1.96.3
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_wrapper_module_for_each

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ $ terraform apply
133133
| Name | Version |
134134
|------|---------|
135135
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
136-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.37.0 |
136+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61.0 |
137137

138138
## Providers
139139

140140
| Name | Version |
141141
|------|---------|
142-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.37.0 |
142+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61.0 |
143143

144144
## Modules
145145

@@ -190,6 +190,7 @@ No modules.
190190
| <a name="input_domain_name_description"></a> [domain\_name\_description](#input\_domain\_name\_description) | A description of the Domain Name. | `string` | `null` | no |
191191
| <a name="input_dynamodb_allowed_actions"></a> [dynamodb\_allowed\_actions](#input\_dynamodb\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_DYNAMODB | `list(string)` | <pre>[<br/> "dynamodb:GetItem",<br/> "dynamodb:PutItem",<br/> "dynamodb:DeleteItem",<br/> "dynamodb:UpdateItem",<br/> "dynamodb:Query",<br/> "dynamodb:Scan",<br/> "dynamodb:BatchGetItem",<br/> "dynamodb:BatchWriteItem"<br/>]</pre> | no |
192192
| <a name="input_elasticsearch_allowed_actions"></a> [elasticsearch\_allowed\_actions](#input\_elasticsearch\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_ELASTICSEARCH | `list(string)` | <pre>[<br/> "es:ESHttpDelete",<br/> "es:ESHttpHead",<br/> "es:ESHttpGet",<br/> "es:ESHttpPost",<br/> "es:ESHttpPut"<br/>]</pre> | no |
193+
| <a name="input_enhanced_metrics_config"></a> [enhanced\_metrics\_config](#input\_enhanced\_metrics\_config) | Nested argument containing Lambda Ehanced metrics configuration. | `map(string)` | `{}` | no |
193194
| <a name="input_eventbridge_allowed_actions"></a> [eventbridge\_allowed\_actions](#input\_eventbridge\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_EVENTBRIDGE | `list(string)` | <pre>[<br/> "events:PutEvents"<br/>]</pre> | no |
194195
| <a name="input_functions"></a> [functions](#input\_functions) | Map of functions to create | `any` | `{}` | no |
195196
| <a name="input_graphql_api_tags"></a> [graphql\_api\_tags](#input\_graphql\_api\_tags) | Map of tags to add to GraphQL API | `map(string)` | `{}` | no |

examples/complete/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@ EOF
333333
]
334334
}
335335
}
336+
337+
enhanced_metrics_config = {
338+
data_source_level_metrics_behavior = "PER_DATA_SOURCE_METRICS"
339+
operation_level_metrics_config = "ENABLED"
340+
resolver_level_metrics_behavior = "FULL_REQUEST_RESOLVER_METRICS"
341+
}
336342
}
337343

338344
##################

main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ resource "aws_appsync_graphql_api" "this" {
9999
}
100100
}
101101

102+
dynamic "enhanced_metrics_config" {
103+
for_each = length(keys(var.enhanced_metrics_config)) == 0 ? [] : [true]
104+
105+
content {
106+
data_source_level_metrics_behavior = lookup(var.enhanced_metrics_config, "data_source_level_metrics_behavior", null)
107+
operation_level_metrics_config = lookup(var.enhanced_metrics_config, "operation_level_metrics_config", null)
108+
resolver_level_metrics_behavior = lookup(var.enhanced_metrics_config, "resolver_level_metrics_behavior", null)
109+
}
110+
}
111+
102112
tags = merge({ Name = var.name }, var.graphql_api_tags)
103113
}
104114

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ variable "additional_authentication_provider" {
106106
default = {}
107107
}
108108

109+
variable "enhanced_metrics_config" {
110+
description = "Nested argument containing Lambda Ehanced metrics configuration."
111+
type = map(string)
112+
default = {}
113+
}
114+
109115
variable "graphql_api_tags" {
110116
description = "Map of tags to add to GraphQL API"
111117
type = map(string)

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.37.0"
7+
version = ">= 5.61.0"
88
}
99
}
1010
}

wrappers/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module "wrapper" {
4747
domain_name_description = try(each.value.domain_name_description, var.defaults.domain_name_description, null)
4848
dynamodb_allowed_actions = try(each.value.dynamodb_allowed_actions, var.defaults.dynamodb_allowed_actions, ["dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:DeleteItem", "dynamodb:UpdateItem", "dynamodb:Query", "dynamodb:Scan", "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem"])
4949
elasticsearch_allowed_actions = try(each.value.elasticsearch_allowed_actions, var.defaults.elasticsearch_allowed_actions, ["es:ESHttpDelete", "es:ESHttpHead", "es:ESHttpGet", "es:ESHttpPost", "es:ESHttpPut"])
50+
enhanced_metrics_config = try(each.value.enhanced_metrics_config, var.defaults.enhanced_metrics_config, {})
5051
eventbridge_allowed_actions = try(each.value.eventbridge_allowed_actions, var.defaults.eventbridge_allowed_actions, ["events:PutEvents"])
5152
functions = try(each.value.functions, var.defaults.functions, {})
5253
graphql_api_tags = try(each.value.graphql_api_tags, var.defaults.graphql_api_tags, {})

wrappers/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.37.0"
7+
version = ">= 5.61.0"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)