Skip to content

Commit

Permalink
Merge pull request hashicorp#39117 from dex4er/bugfix/aws_imagebuilde…
Browse files Browse the repository at this point in the history
…r_image_pipeline-image_recipe_arn-not_new

Change for recipe ARN should not force new pipeline
  • Loading branch information
ewbankkit authored Oct 29, 2024
2 parents ceef509 + 5d5350f commit b4ada46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
7 changes: 7 additions & 0 deletions .changelog/39117.txt
Original file line number Diff line number Diff line change
@@ -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)
```
4 changes: 4 additions & 0 deletions internal/service/imagebuilder/container_recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
Expand Down Expand Up @@ -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),
},
},
Expand Down
15 changes: 1 addition & 14 deletions internal/service/imagebuilder/image_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
Expand Down Expand Up @@ -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"},
},
Expand Down Expand Up @@ -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)),
Expand Down

0 comments on commit b4ada46

Please sign in to comment.