Skip to content

Commit

Permalink
Merge pull request #35269 from hashicorp/b-ecr_image_most_recent
Browse files Browse the repository at this point in the history
r/aws_ecr_image: fix regression for most recent
  • Loading branch information
johnsonaj authored Jan 12, 2024
2 parents e8ee3c9 + f7b9405 commit 31e9088
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .changelog/35269.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
data-source/aws_ecr_image: Fix error when `most_recent` is not also `latest`
```
12 changes: 0 additions & 12 deletions internal/service/ecr/image_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,6 @@ func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta inter
}
}

if v, ok := d.Get("most_recent").(bool); ok && v {
if len(input.ImageIds) == 0 {
input.ImageIds = []*ecr.ImageIdentifier{
{
ImageTag: aws.String("latest"),
},
}
} else {
input.ImageIds[0].ImageTag = aws.String("latest")
}
}

if v, ok := d.GetOk("registry_id"); ok {
input.RegistryId = aws.String(v.(string))
}
Expand Down
1 change: 0 additions & 1 deletion internal/service/ecr/image_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func TestAccECRImageDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(resourceByDigest, "image_uri"),
resource.TestCheckResourceAttrSet(resourceByMostRecent, "image_pushed_at"),
resource.TestCheckResourceAttrSet(resourceByMostRecent, "image_size_in_bytes"),
resource.TestCheckTypeSetElemAttr(resourceByMostRecent, "image_tags.*", tag),
),
},
},
Expand Down

0 comments on commit 31e9088

Please sign in to comment.