diff --git a/.changelog/35269.txt b/.changelog/35269.txt new file mode 100644 index 00000000000..23c435306f8 --- /dev/null +++ b/.changelog/35269.txt @@ -0,0 +1,3 @@ +```release-note:bug +data-source/aws_ecr_image: Fix error when `most_recent` is not also `latest` +``` diff --git a/internal/service/ecr/image_data_source.go b/internal/service/ecr/image_data_source.go index 8932629b1c0..42ee4ff20d1 100644 --- a/internal/service/ecr/image_data_source.go +++ b/internal/service/ecr/image_data_source.go @@ -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)) } diff --git a/internal/service/ecr/image_data_source_test.go b/internal/service/ecr/image_data_source_test.go index a7e3325e6f0..8f8a3e97ec2 100644 --- a/internal/service/ecr/image_data_source_test.go +++ b/internal/service/ecr/image_data_source_test.go @@ -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), ), }, },