From c18861e27772195ffa019204c2dd7c6d96ba64f4 Mon Sep 17 00:00:00 2001 From: srouaix Date: Tue, 7 Jan 2025 21:48:05 +0100 Subject: [PATCH 1/2] feat: Add enhanced_metrics_config (#68) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Rouaix Co-authored-by: Anton Babenko --- .pre-commit-config.yaml | 2 +- README.md | 5 +++-- examples/complete/main.tf | 6 ++++++ main.tf | 10 ++++++++++ variables.tf | 6 ++++++ versions.tf | 2 +- wrappers/main.tf | 1 + wrappers/versions.tf | 2 +- 8 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7e4e7da..19691e5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.96.1 + rev: v1.96.3 hooks: - id: terraform_fmt - id: terraform_wrapper_module_for_each diff --git a/README.md b/README.md index c253f40..7a8ca6f 100644 --- a/README.md +++ b/README.md @@ -133,13 +133,13 @@ $ terraform apply | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.37.0 | +| [aws](#requirement\_aws) | >= 5.61.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.37.0 | +| [aws](#provider\_aws) | >= 5.61.0 | ## Modules @@ -190,6 +190,7 @@ No modules. | [domain\_name\_description](#input\_domain\_name\_description) | A description of the Domain Name. | `string` | `null` | no | | [dynamodb\_allowed\_actions](#input\_dynamodb\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_DYNAMODB | `list(string)` |
[
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:DeleteItem",
"dynamodb:UpdateItem",
"dynamodb:Query",
"dynamodb:Scan",
"dynamodb:BatchGetItem",
"dynamodb:BatchWriteItem"
]
| no | | [elasticsearch\_allowed\_actions](#input\_elasticsearch\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_ELASTICSEARCH | `list(string)` |
[
"es:ESHttpDelete",
"es:ESHttpHead",
"es:ESHttpGet",
"es:ESHttpPost",
"es:ESHttpPut"
]
| no | +| [enhanced\_metrics\_config](#input\_enhanced\_metrics\_config) | Nested argument containing Lambda Ehanced metrics configuration. | `map(string)` | `{}` | no | | [eventbridge\_allowed\_actions](#input\_eventbridge\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_EVENTBRIDGE | `list(string)` |
[
"events:PutEvents"
]
| no | | [functions](#input\_functions) | Map of functions to create | `any` | `{}` | no | | [graphql\_api\_tags](#input\_graphql\_api\_tags) | Map of tags to add to GraphQL API | `map(string)` | `{}` | no | diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 691cded..d6d6eb7 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -333,6 +333,12 @@ EOF ] } } + + enhanced_metrics_config = { + data_source_level_metrics_behavior = "PER_DATA_SOURCE_METRICS" + operation_level_metrics_config = "ENABLED" + resolver_level_metrics_behavior = "FULL_REQUEST_RESOLVER_METRICS" + } } ################## diff --git a/main.tf b/main.tf index 3e959cf..736e58a 100644 --- a/main.tf +++ b/main.tf @@ -99,6 +99,16 @@ resource "aws_appsync_graphql_api" "this" { } } + dynamic "enhanced_metrics_config" { + for_each = length(keys(var.enhanced_metrics_config)) == 0 ? [] : [true] + + content { + data_source_level_metrics_behavior = lookup(var.enhanced_metrics_config, "data_source_level_metrics_behavior", null) + operation_level_metrics_config = lookup(var.enhanced_metrics_config, "operation_level_metrics_config", null) + resolver_level_metrics_behavior = lookup(var.enhanced_metrics_config, "resolver_level_metrics_behavior", null) + } + } + tags = merge({ Name = var.name }, var.graphql_api_tags) } diff --git a/variables.tf b/variables.tf index 801225f..d06cd72 100644 --- a/variables.tf +++ b/variables.tf @@ -106,6 +106,12 @@ variable "additional_authentication_provider" { default = {} } +variable "enhanced_metrics_config" { + description = "Nested argument containing Lambda Ehanced metrics configuration." + type = map(string) + default = {} +} + variable "graphql_api_tags" { description = "Map of tags to add to GraphQL API" type = map(string) diff --git a/versions.tf b/versions.tf index 7bdc37e..ee879be 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.37.0" + version = ">= 5.61.0" } } } diff --git a/wrappers/main.tf b/wrappers/main.tf index 947f113..7cb2ac3 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -47,6 +47,7 @@ module "wrapper" { domain_name_description = try(each.value.domain_name_description, var.defaults.domain_name_description, null) 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"]) elasticsearch_allowed_actions = try(each.value.elasticsearch_allowed_actions, var.defaults.elasticsearch_allowed_actions, ["es:ESHttpDelete", "es:ESHttpHead", "es:ESHttpGet", "es:ESHttpPost", "es:ESHttpPut"]) + enhanced_metrics_config = try(each.value.enhanced_metrics_config, var.defaults.enhanced_metrics_config, {}) eventbridge_allowed_actions = try(each.value.eventbridge_allowed_actions, var.defaults.eventbridge_allowed_actions, ["events:PutEvents"]) functions = try(each.value.functions, var.defaults.functions, {}) graphql_api_tags = try(each.value.graphql_api_tags, var.defaults.graphql_api_tags, {}) diff --git a/wrappers/versions.tf b/wrappers/versions.tf index 7bdc37e..ee879be 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.37.0" + version = ">= 5.61.0" } } } From ea0f8472e314b30d1fe1232855d85ddab4dca78c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 7 Jan 2025 20:48:32 +0000 Subject: [PATCH 2/2] chore(release): version 2.6.0 [skip ci] ## [2.6.0](https://github.com/terraform-aws-modules/terraform-aws-appsync/compare/v2.5.1...v2.6.0) (2025-01-07) ### Features * Add enhanced_metrics_config ([#68](https://github.com/terraform-aws-modules/terraform-aws-appsync/issues/68)) ([c18861e](https://github.com/terraform-aws-modules/terraform-aws-appsync/commit/c18861e27772195ffa019204c2dd7c6d96ba64f4)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8577813..484baf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## [2.6.0](https://github.com/terraform-aws-modules/terraform-aws-appsync/compare/v2.5.1...v2.6.0) (2025-01-07) + + +### Features + +* Add enhanced_metrics_config ([#68](https://github.com/terraform-aws-modules/terraform-aws-appsync/issues/68)) ([c18861e](https://github.com/terraform-aws-modules/terraform-aws-appsync/commit/c18861e27772195ffa019204c2dd7c6d96ba64f4)) + ## [2.5.1](https://github.com/terraform-aws-modules/terraform-aws-appsync/compare/v2.5.0...v2.5.1) (2024-10-11)