Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change for recipe ARN should not force new pipeline #39117

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading