Skip to content

Query ami by id #25521

Closed
Closed
@sayurin

Description

@sayurin

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

aws_ami data source requires owners argument. Buf if image-id is known, it should be query without owners.

Motivation

aws_imagebuilder_image data source can query latest ami. It returns image and account_id. But sometimes account_id is empty. Or AMI public parameters can get image-id only.

Then aws_imagebuilder_image_recipe resource can set ebs parameters. When specify root volume, device_name is required. But root's device_name is not fixed, and it depends on ami. It can query only aws_ami data source.

New or Affected Resource(s)

  • aws_ami (data source)
  • aws_ami_by_id (data source)

Potential Terraform Configuration

data "aws_ami" "parent" {
  owners = null
  filter {
    name   = "image-id"
    values = ["ami-XXX"]
  }
}

# or simply,

data "aws_ami_by_id" "parent" {
  image_id = "ami-XXX"
}

References

Metadata

Metadata

Assignees

Labels

enhancementRequests to existing resources that expand the functionality or scope.service/ec2Issues and PRs that pertain to the ec2 service.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions