From 9e3b0ebb2de87656e56d63029d26e23f1e51e2e0 Mon Sep 17 00:00:00 2001 From: Michal Owczarek Date: Tue, 18 Apr 2023 10:25:40 +0200 Subject: [PATCH 1/2] Add support for image_configuration block in aws_emrserverless_application resource - it was added in aws provider 4.62.0 --- modules/serverless/main.tf | 8 ++++++++ modules/serverless/variables.tf | 6 ++++++ modules/serverless/versions.tf | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/serverless/main.tf b/modules/serverless/main.tf index 8b012dc..ee4b235 100644 --- a/modules/serverless/main.tf +++ b/modules/serverless/main.tf @@ -83,6 +83,14 @@ resource "aws_emrserverless_application" "this" { } } + dynamic "image_configuration" { + for_each = length(var.image_configuration) > 0 ? [var.image_configuration] : [] + + content { + image_uri = image_configuration.value.image_uri + } + } + release_label = try(coalesce(var.release_label, element(data.aws_emr_release_labels.this[0].release_labels, 0)), "") type = var.type diff --git a/modules/serverless/variables.tf b/modules/serverless/variables.tf index fcd8761..ad0f90f 100644 --- a/modules/serverless/variables.tf +++ b/modules/serverless/variables.tf @@ -32,6 +32,12 @@ variable "auto_stop_configuration" { default = {} } +variable "image_configuration" { + description = "The image configuration applied to all worker types" + type = any + default = {} +} + variable "initial_capacity" { description = "The capacity to initialize when the application is created" type = any diff --git a/modules/serverless/versions.tf b/modules/serverless/versions.tf index b8fc66b..2884bdd 100644 --- a/modules/serverless/versions.tf +++ b/modules/serverless/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.42" + version = ">= 4.62" } } } From ba8bcfdf2a7fdb9652162ab860e9db7310c01cf4 Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Mon, 1 May 2023 12:55:57 -0400 Subject: [PATCH 2/2] chore: Format and update docs to pass CI checks --- .pre-commit-config.yaml | 2 +- modules/serverless/README.md | 5 +++-- modules/serverless/main.tf | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 071427d..f6f54bb 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.77.1 + rev: v1.78.0 hooks: - id: terraform_fmt - id: terraform_validate diff --git a/modules/serverless/README.md b/modules/serverless/README.md index 334a3aa..c9c7128 100644 --- a/modules/serverless/README.md +++ b/modules/serverless/README.md @@ -134,13 +134,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.42 | +| [aws](#requirement\_aws) | >= 4.62 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.42 | +| [aws](#provider\_aws) | >= 4.62 | ## Modules @@ -165,6 +165,7 @@ No modules. | [auto\_stop\_configuration](#input\_auto\_stop\_configuration) | The configuration for an application to automatically stop after a certain amount of time being idle | `any` | `{}` | no | | [create](#input\_create) | Controls if resources should be created (affects nearly all resources) | `bool` | `true` | no | | [create\_security\_group](#input\_create\_security\_group) | Determines whether the security group is created | `bool` | `true` | no | +| [image\_configuration](#input\_image\_configuration) | The image configuration applied to all worker types | `any` | `{}` | no | | [initial\_capacity](#input\_initial\_capacity) | The capacity to initialize when the application is created | `any` | `{}` | no | | [maximum\_capacity](#input\_maximum\_capacity) | The maximum capacity to allocate when the application is created. This is cumulative across all workers at any given point in time, not just when an application is created. No new resources will be created once any one of the defined limits is hit | `any` | `{}` | no | | [name](#input\_name) | The name of the application | `string` | `""` | no | diff --git a/modules/serverless/main.tf b/modules/serverless/main.tf index ee4b235..b9395bf 100644 --- a/modules/serverless/main.tf +++ b/modules/serverless/main.tf @@ -87,7 +87,7 @@ resource "aws_emrserverless_application" "this" { for_each = length(var.image_configuration) > 0 ? [var.image_configuration] : [] content { - image_uri = image_configuration.value.image_uri + image_uri = image_configuration.value.image_uri } }