Difference between revisions of "Terraform resource: aws volume attachment"

From wikieduonline
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
* https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/volume_attachment
+
aws_volume_attachment https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/volume_attachment
  
  
Line 11: Line 11:
 
   instance_id = aws_instance.web.id
 
   instance_id = aws_instance.web.id
 
  }
 
  }
<pre>
 
resource "aws_instance" "web" {
 
  ami              = "ami-21f78e11"
 
  availability_zone = "us-west-2a"
 
  instance_type    = "t2.micro"
 
 
  tags = {
 
    Name = "HelloWorld"
 
  }
 
}
 
 
resource "aws_ebs_volume" "example" {
 
  availability_zone = "us-west-2a"
 
  size              = 1
 
}
 
</pre>
 
  
 +
resource "aws_instance" "web" {
 +
  ami              = "ami-21f78e11"
 +
  availability_zone = "us-west-2a"
 +
  instance_type    = "t2.micro"
 +
 +
  tags = {
 +
    Name = "HelloWorld"
 +
  }
 +
}
 +
 +
resource "[[aws_ebs_volume]]" "example" {
 +
  availability_zone = "us-west-2a"
 +
  size              = 1
 +
}
  
 
== Related ==
 
== Related ==
* <code>[[aws_instance]]</code>
+
* [[Terraform resource]]: <code>[[aws_instance]]</code>
* <code>[[aws_ebs_volume]]</code>
+
* [[Terraform resource]]: <code>[[aws_ebs_volume]]</code>
 
* <code>[[ebs_block_device]]</code> argument for [[aws_instance]] resource
 
* <code>[[ebs_block_device]]</code> argument for [[aws_instance]] resource
 
* [[Terraform apply: ec2 instance example (aws instance)]]
 
* [[Terraform apply: ec2 instance example (aws instance)]]
 +
* [[user_data]]
  
 
== See also ==
 
== See also ==

Latest revision as of 11:38, 25 October 2024

aws_volume_attachment https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/volume_attachment


  skip_destroy = true

Official example[edit]

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     = "t2.micro"

  tags = {
    Name = "HelloWorld"
  }
}

resource "aws_ebs_volume" "example" {
  availability_zone = "us-west-2a"
  size              = 1
}

Related[edit]

See also[edit]

Advertising: