From c9c6a290490fa570e284b23463903cb9e26d5da0 Mon Sep 17 00:00:00 2001 From: Kamil Turek Date: Mon, 31 Jan 2022 23:27:41 +0100 Subject: [PATCH 1/3] Add parameter attribute to component block --- .../imagebuilder/image_recipe_data_source.go | 16 ++++++++++++++++ .../image_recipe_data_source_test.go | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/internal/service/imagebuilder/image_recipe_data_source.go b/internal/service/imagebuilder/image_recipe_data_source.go index 8f7257c77a4c..be519d05c3c4 100644 --- a/internal/service/imagebuilder/image_recipe_data_source.go +++ b/internal/service/imagebuilder/image_recipe_data_source.go @@ -86,6 +86,22 @@ func DataSourceImageRecipe() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "parameter": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, }, }, }, diff --git a/internal/service/imagebuilder/image_recipe_data_source_test.go b/internal/service/imagebuilder/image_recipe_data_source_test.go index 3090979bf487..982375f57332 100644 --- a/internal/service/imagebuilder/image_recipe_data_source_test.go +++ b/internal/service/imagebuilder/image_recipe_data_source_test.go @@ -27,6 +27,10 @@ func TestAccImageBuilderImageRecipeDataSource_arn(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "block_device_mapping.#", resourceName, "block_device_mapping.#"), resource.TestCheckResourceAttrPair(dataSourceName, "component.#", resourceName, "component.#"), + resource.TestCheckResourceAttrPair(dataSourceName, "component.0.component_arn", resourceName, "component.0.component_arn"), + resource.TestCheckResourceAttrPair(dataSourceName, "component.0.parameter.#", resourceName, "component.0.parameter.#"), + resource.TestCheckResourceAttrPair(dataSourceName, "component.0.parameter.0.name", resourceName, "component.0.parameter.0.name"), + resource.TestCheckResourceAttrPair(dataSourceName, "component.0.parameter.0.value", resourceName, "component.0.parameter.0.value"), resource.TestCheckResourceAttrPair(dataSourceName, "date_created", resourceName, "date_created"), resource.TestCheckResourceAttrPair(dataSourceName, "description", resourceName, "description"), resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"), @@ -62,6 +66,11 @@ resource "aws_imagebuilder_component" "test" { onFailure = "Continue" }] }] + parameters = [{ + Parameter1 = { + type = "string" + } + }] schemaVersion = 1.0 }) name = %[1]q @@ -72,6 +81,11 @@ resource "aws_imagebuilder_component" "test" { resource "aws_imagebuilder_image_recipe" "test" { component { component_arn = aws_imagebuilder_component.test.arn + + parameter { + name = "Parameter1" + value = "Value1" + } } name = %[1]q From 8329d2a43911a9f6e3b9238475f7d89c1d809cda Mon Sep 17 00:00:00 2001 From: Kamil Turek Date: Mon, 31 Jan 2022 23:29:48 +0100 Subject: [PATCH 2/3] Update docs --- website/docs/d/imagebuilder_image_recipe.html.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/docs/d/imagebuilder_image_recipe.html.markdown b/website/docs/d/imagebuilder_image_recipe.html.markdown index d8384be100fa..0e2070134ef7 100644 --- a/website/docs/d/imagebuilder_image_recipe.html.markdown +++ b/website/docs/d/imagebuilder_image_recipe.html.markdown @@ -42,6 +42,9 @@ In addition to all arguments above, the following attributes are exported: * `virtual_name` - Virtual device name. For example, `ephemeral0`. Instance store volumes are numbered starting from 0. * `component` - List of objects with components for the image recipe. * `component_arn` - Amazon Resource Name (ARN) of the Image Builder Component. + * `parameter` - Set of parameters that are used to configure the component. + * `name` - Name of the component parameter. + * `value` - Value of the component parameter. * `date_created` - Date the image recipe was created. * `description` - Description of the image recipe. * `name` - Name of the image recipe. From d03f2e3d2e1ba94f7e7bc90a45b77e0bf47766d2 Mon Sep 17 00:00:00 2001 From: Kamil Turek Date: Mon, 31 Jan 2022 23:36:43 +0100 Subject: [PATCH 3/3] Add changelog --- .changelog/22856.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/22856.txt diff --git a/.changelog/22856.txt b/.changelog/22856.txt new file mode 100644 index 000000000000..8831bba8b11b --- /dev/null +++ b/.changelog/22856.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +data-source/aws_imagebuilder_image_recipe: Add `parameter` attribute to the `component` configuration block +```