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
• 6,500 points
151 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,200 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,560 points
156 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,040 points
304 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 in Other DevOps Questions by Nisha
14 views
0 votes
1 answer

Copy log files to local machines using Jenkins

Try initializing the variables with values according ...READ MORE

answered May 2, 2018 in Other DevOps Questions by ajs3033
• 7,040 points
34 views
+13 votes
2 answers
0 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,200 points
24 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,200 points
28 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.