mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Merge pull request #9277 from kwilczynski/fix/return-correct-image-data_source_aws_ami
provider/aws: Fix. Return correct AMI image when `most_recent` is set to `true`.
This commit is contained in:
commit
1b2f553d52
@ -270,11 +270,12 @@ func dataSourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error {
|
|||||||
return fmt.Errorf("Your query returned more than one result. Please try a more " +
|
return fmt.Errorf("Your query returned more than one result. Please try a more " +
|
||||||
"specific search criteria, or set `most_recent` attribute to true.")
|
"specific search criteria, or set `most_recent` attribute to true.")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Query returned single result.
|
||||||
|
image = filteredImages[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
image = filteredImages[0]
|
|
||||||
log.Printf("[DEBUG] aws_ami - Single AMI found: %s", *image.ImageId)
|
log.Printf("[DEBUG] aws_ami - Single AMI found: %s", *image.ImageId)
|
||||||
|
|
||||||
return amiDescriptionAttributes(d, image)
|
return amiDescriptionAttributes(d, image)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user