1.5 KiB
1.5 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
aws | AWS: aws_volume_attachment | docs-aws-resource-volume-attachment | Provides an AWS EBS Volume Attachment |
aws_volume_attachment
Provides an AWS EBS Volume Attachment as a top level resource, to attach and detach volumes from AWS Instances.
Example Usage
resource "aws_volume_attachment" "ebs_att" {
device_name = "/dev/sdh"
volume_id = "${aws_ebs_volume.example.id}"
instance_id = "${aws_instance.web.id}"
}
resource "aws_instance" "web" {
ami = "ami-21f78e11"
availability_zone = "us-west-2a"
instance_type = "t1.micro"
tags {
Name = "HelloWorld"
}
}
resource "aws_ebs_volume" "example" {
availability_zone = "us-west-2a"
size = 1
}
Argument Reference
The following arguments are supported:
device_name
- (Required) The device name to expose to the instance (for example,/dev/sdh
orxvdh
)instance_id
- (Required) ID of the Instance to attach tovolume_id
- (Required) ID of the Volume to be attachedforce_detach
- (Optional, Boolean) Set totrue
if you want to force the volume to detach. Useful if previous attempts failed, but use this option only as a last resort, as this can result in data loss. See Detaching an Amazon EBS Volume from an Instance for more information.
Attributes Reference
device_name
- The device name exposed to the instanceinstance_id
- ID of the Instancevolume_id
- ID of the Volume