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:
Paul Stack 2016-10-07 12:26:29 +01:00 committed by GitHub
commit 1b2f553d52
1 changed files with 3 additions and 2 deletions

View File

@ -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 " +
"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)
return amiDescriptionAttributes(d, image)
}