From da69db3d751d6009cb0817993361e64658385aca Mon Sep 17 00:00:00 2001 From: Piotr Roszatycki Date: Mon, 2 Sep 2024 20:38:28 +0200 Subject: [PATCH 1/4] Change for recipe ARN should not force new pipeline --- internal/service/imagebuilder/image_pipeline.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/internal/service/imagebuilder/image_pipeline.go b/internal/service/imagebuilder/image_pipeline.go index 174bca68b69..c287d045e42 100644 --- a/internal/service/imagebuilder/image_pipeline.go +++ b/internal/service/imagebuilder/image_pipeline.go @@ -43,7 +43,6 @@ func ResourceImagePipeline() *schema.Resource { "container_recipe_arn": { Type: schema.TypeString, Optional: true, - ForceNew: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^arn:aws[^:]*:imagebuilder:[^:]+:(?:\d{12}|aws):container-recipe/[0-9a-z_-]+/\d+\.\d+\.\d+$`), "valid container recipe ARN must be provided"), ExactlyOneOf: []string{"container_recipe_arn", "image_recipe_arn"}, }, @@ -86,7 +85,6 @@ func ResourceImagePipeline() *schema.Resource { "image_recipe_arn": { Type: schema.TypeString, Optional: true, - ForceNew: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^arn:aws[^:]*:imagebuilder:[^:]+:(?:\d{12}|aws):image-recipe/[0-9a-z_-]+/\d+\.\d+\.\d+$`), "valid image recipe ARN must be provided"), ExactlyOneOf: []string{"container_recipe_arn", "image_recipe_arn"}, }, From c299f491e1c4c92721c2691d2819fe9be5dbeeca Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 11:17:03 -0400 Subject: [PATCH 2/4] Add CHANGELOG entry. --- .changelog/39117.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/39117.txt diff --git a/.changelog/39117.txt b/.changelog/39117.txt new file mode 100644 index 00000000000..3aba7f3b7a5 --- /dev/null +++ b/.changelog/39117.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_imagebuilder_image_pipeline: Allow `container_recipe_arn` and `image_recipe_arn` to be updated in-place +``` \ No newline at end of file From 0a44ea20cedce7afb7e5681333932eaa66b701ad Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 11:32:43 -0400 Subject: [PATCH 3/4] Correct change detection. --- internal/service/imagebuilder/image_pipeline.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/internal/service/imagebuilder/image_pipeline.go b/internal/service/imagebuilder/image_pipeline.go index d0978a9f16e..9717bd70157 100644 --- a/internal/service/imagebuilder/image_pipeline.go +++ b/internal/service/imagebuilder/image_pipeline.go @@ -382,18 +382,7 @@ func resourceImagePipelineUpdate(ctx context.Context, d *schema.ResourceData, me var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ImageBuilderClient(ctx) - if d.HasChanges( - names.AttrDescription, - "distribution_configuration_arn", - "enhanced_image_metadata_enabled", - "execution_role", - "image_scanning_configuration", - "image_tests_configuration", - "infrastructure_configuration_arn", - names.AttrSchedule, - names.AttrStatus, - "workflow", - ) { + if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { input := &imagebuilder.UpdateImagePipelineInput{ ClientToken: aws.String(id.UniqueId()), EnhancedImageMetadataEnabled: aws.Bool(d.Get("enhanced_image_metadata_enabled").(bool)), From 5d5350f71a899ec5fcbad57deaf4906af6ae8337 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 29 Oct 2024 11:39:39 -0400 Subject: [PATCH 4/4] r/aws_imagebuilder_container_recipe: Change `component.parameter.name`, `component.parameter.value`, `target_repository.repository_name`, and `target_repository.service` to ForceNew. --- .changelog/39117.txt | 4 ++++ internal/service/imagebuilder/container_recipe.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.changelog/39117.txt b/.changelog/39117.txt index 3aba7f3b7a5..b34e66f7385 100644 --- a/.changelog/39117.txt +++ b/.changelog/39117.txt @@ -1,3 +1,7 @@ ```release-note:enhancement resource/aws_imagebuilder_image_pipeline: Allow `container_recipe_arn` and `image_recipe_arn` to be updated in-place +``` + +```release-note:bug +resource/aws_imagebuilder_container_recipe: Change `component.parameter.name`, `component.parameter.value`, `target_repository.repository_name`, and `target_repository.service` to [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew) ``` \ No newline at end of file diff --git a/internal/service/imagebuilder/container_recipe.go b/internal/service/imagebuilder/container_recipe.go index ff0205da6eb..123e67505a5 100644 --- a/internal/service/imagebuilder/container_recipe.go +++ b/internal/service/imagebuilder/container_recipe.go @@ -67,11 +67,13 @@ func resourceContainerRecipe() *schema.Resource { names.AttrName: { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 256), }, names.AttrValue: { Type: schema.TypeString, Required: true, + ForceNew: true, }, }, }, @@ -264,11 +266,13 @@ func resourceContainerRecipe() *schema.Resource { names.AttrRepositoryName: { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 1024), }, "service": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"ECR"}, false), }, },