Configuration in this directory creates EC2 instances, EBS volume and attach it together.
This example outputs instance id and EBS volume id.
To run this example you need to execute:
$ terraform init
$ terraform plan
$ terraform apply
Note that this example may create resources which can cost money. Run terraform destroy
when you don't need these resources.
Name | Version |
---|---|
terraform | >= 1.0 |
aws | >= 4.66 |
Name | Version |
---|---|
aws | >= 4.66 |
Name | Source | Version |
---|---|---|
ec2 | ../../ | n/a |
security_group | terraform-aws-modules/security-group/aws | ~> 4.0 |
vpc | terraform-aws-modules/vpc/aws | ~> 4.0 |
Name | Type |
---|---|
aws_ebs_volume.this | resource |
aws_volume_attachment.this | resource |
aws_ami.amazon_linux | data source |
aws_availability_zones.available | data source |
No inputs.
Name | Description |
---|---|
ec2_arn | The ARN of the instance |
ec2_availability_zone | The availability zone of the created spot instance |
ec2_capacity_reservation_specification | Capacity reservation specification of the instance |
ec2_id | The ID of the instance |
ec2_instance_state | The state of the instance. One of: pending , running , shutting-down , terminated , stopping , stopped |
ec2_primary_network_interface_id | The ID of the instance's primary network interface |
ec2_private_dns | The private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC |
ec2_public_dns | The public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC |
ec2_public_ip | The public IP address assigned to the instance, if applicable. NOTE: If you are using an aws_eip with your instance, you should refer to the EIP's address directly and not use public_ip as this field will change after the EIP is attached |
ec2_tags_all | A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block |