How to get the most recent ebs snapshot using terraform datasource

0 votes

I am trying to get the most recent created snapshot using terraform, don't know how to do it, according to terraform's document, for aws ami, it can be done by:

data "aws_ami" "web" {
  filter {
    name = "state"
    values = ["available"]
  }
  filter {
    name = "tag:Component"
    values = ["web"]
  }
  most_recent = true
}

I am expecting similar things for ebs snapshot like:

data "aws_ebs_snapshot" "latest_snapshot" {
  filter {
    name = "state"
    values = ["available"]
  }
  most_recent = true
}

But there is no "most_recent" argument at the reference page for data -> "aws_ebs_snapshot" here, so how can I get the most recent created snapshot using terraform? and why cannot we use the similar syntax as what aws_ami has?

Jul 8, 2018 in Other DevOps Questions by shubham
• 7,320 points
738 views

1 answer to this question.

0 votes

It's not available in the latest release of Terraform v0.8.2 currently, but this feature has been merged into the latest master of Terraform just a few days ago.

Yo can see the below link for reference.

https://github.com/hashicorp/terraform/pull/10986

It is also listed in CHANGELOG of the next release v0.8.3, so it will be available soon.

answered Jul 8, 2018 by Atul
• 10,240 points

Related Questions In Other DevOps Questions

0 votes
1 answer

How to get issues count based on rules in a sonar project?

There are API docs in the footer ...READ MORE

answered May 4, 2018 in Other DevOps Questions by DareDev
• 6,890 points
1,479 views
0 votes
1 answer

How to get results of SonarQube?

You can use sonarqube quality gates which ...READ MORE

answered Jun 8, 2018 in Other DevOps Questions by ajs3033
• 7,280 points
2,083 views
0 votes
1 answer

Do DevOps tools work together to bring out the DevOps culture? How?

Yes, of course, DevOps tools work together.  Developers ...READ MORE

answered Feb 16, 2019 in Other DevOps Questions by Nisha
114 views
0 votes
1 answer

I can't able to create AWS KMS key using terraform

Hello @ Lakshminarayanan, Is that your actual Terraform for ...READ MORE

answered Aug 3, 2020 in Other DevOps Questions by Niroj
• 82,760 points
1,296 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,135 views
+2 votes
1 answer
0 votes
1 answer

What is the best practice for updating an already existing web app deployment using ARM?

The Service Principal solution, through the SDK, ...READ MORE

answered Jul 8, 2018 in Other DevOps Questions by Atul
• 10,240 points
134 views
0 votes
1 answer

How do I enable Slack for Bluemix DevOps services beta

Here is where you can take help ...READ MORE

answered Jul 11, 2018 in Other DevOps Questions by Atul
• 10,240 points
133 views