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 9, 2018 in Other DevOps Questions by shubham
• 7,340 points
1,474 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 9, 2018 by Atul
• 10,240 points

Related Questions In Other DevOps Questions

0 votes
0 answers

How to get items from Azure Devops using Python

I created a Python script that clones ...READ MORE

Apr 19, 2022 in Other DevOps Questions by Kichu
• 19,050 points
1,289 views
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
2,590 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,300 points
2,876 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,531 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 9, 2018 in Other DevOps Questions by Atul
• 10,240 points
426 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
386 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP