Files
opentf/website/source/docs/providers/aws/d/ebs_volume.html.markdown
Paul Stack aaece37ec9 provider/aws: Adding a datasource for aws_ebs_volume (#9753)
This will allows us to filter a specific ebs_volume for attachment to an
aws_instance

```
make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSEbsVolumeDataSource_'✹
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/11/01 12:39:19 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSEbsVolumeDataSource_ -timeout 120m
=== RUN   TestAccAWSEbsVolumeDataSource_basic
--- PASS: TestAccAWSEbsVolumeDataSource_basic (28.74s)
=== RUN   TestAccAWSEbsVolumeDataSource_multipleFilters
--- PASS: TestAccAWSEbsVolumeDataSource_multipleFilters (28.37s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws57.145s
```
2016-11-01 14:15:31 +00:00

1.4 KiB

layout, page_title, sidebar_current, description
layout page_title sidebar_current description
aws AWS: aws_ebs_volume docs-aws-datasource-ebs-volume Get information on an EBS volume.

aws_ebs_volume

Use this data source to get information about an EBS volume for use in other resources.

Example Usage

data "aws_ebs_volume" "ebs_volume" {
    most_recent = true
    filter {
        name = "volume-type"
        values = ["gp2"]
    }
    filter {
        name = "tag:Name"
        values = ["Example"]
    }
}

Argument Reference

The following arguments are supported:

  • most_recent - (Optional) If more than one result is returned, use the most recent Volume.
  • filter - (Optional) One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out describe-volumes in the AWS CLI reference.

Attributes Reference

The following attributes are exported:

  • id - The volume ID (e.g. vol-59fcb34e).
  • volume_id - The volume ID (e.g. vol-59fcb34e).
  • availability_zone - The AZ where the EBS volume exists.
  • encrypted - Whether the disk is encrypted.
  • iops - The amount of IOPS for the disk.
  • size - The size of the drive in GiBs.
  • snapshot_id - The snapshot_id the EBS volume is based off.
  • volume_type - The type of EBS volume.
  • kms_key_id - The ARN for the KMS encryption key.
  • tags - A mapping of tags for the resource.