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,890 points
282 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,810 points
453 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
796 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
31 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,280 points
58 views
+13 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,380 points
217 views
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,240 points
38 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
50 views