diff --git a/.changelog/39117.txt b/.changelog/39117.txt new file mode 100644 index 00000000000..b34e66f7385 --- /dev/null +++ b/.changelog/39117.txt @@ -0,0 +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), }, }, diff --git a/internal/service/imagebuilder/image_pipeline.go b/internal/service/imagebuilder/image_pipeline.go index 167634f2cc0..9717bd70157 100644 --- a/internal/service/imagebuilder/image_pipeline.go +++ b/internal/service/imagebuilder/image_pipeline.go @@ -48,7 +48,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"}, }, @@ -91,7 +90,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"}, }, @@ -384,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)),