terraform/website/source/docs/providers/aws/d/instance.html.markdown

99 lines
4.4 KiB
Markdown
Raw Normal View History

provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
---
layout: "aws"
page_title: "AWS: aws_instance"
sidebar_current: "docs-aws-datasource-instance"
description: |-
Get information on an Amazon EC2 Instance.
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
---
# aws\_instance
Use this data source to get the ID of an Amazon EC2 Instance for use in other
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
resources.
## Example Usage
```hcl
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
data "aws_instance" "foo" {
instance_id = "i-instanceid"
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
filter {
name = "image-id"
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
values = ["ami-xxxxxxxx"]
}
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
filter {
name = "tag:Name"
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
values = ["instance-name-tag"]
}
}
```
## Argument Reference
* `instance_id` - (Optional) Specify the exact Instance ID with which to populate the data source.
* `instance_tags` - (Optional) A mapping of tags, each pair of which must
exactly match a pair on the desired Instance.
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
* `filter` - (Optional) One or more name/value pairs to use as filters. There are
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
several valid keys, for a full reference, check out
[describe-instances in the AWS CLI reference][1].
~> **NOTE:** At least one of `filter`, `instance_tags`, or `instance_id` must be specified.
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
~> **NOTE:** If anything other than a single match is returned by the search,
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
Terraform will fail. Ensure that your search is specific enough to return
a single Instance ID only.
## Attributes Reference
`id` is set to the ID of the found Instance. In addition, the following attributes
are exported:
~> **NOTE:** Some values are not always set and may not be available for
interpolation.
* `associate_public_ip_address` - Whether or not the Instance is associated with a public IP address or not (Boolean).
* `availability_zone` - The availability zone of the Instance.
* `ebs_block_device` - The EBS block device mappings of the Instance.
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
* `delete_on_termination` - If the EBS volume will be deleted on termination.
* `device_name` - The physical name of the device.
* `encrypted` - If the EBS volume is encrypted.
* `iops` - `0` If the EBS volume is not a provisioned IOPS image, otherwise the supported IOPS count.
* `snapshot_id` - The ID of the snapshot.
* `volume_size` - The size of the volume, in GiB.
* `volume_type` - The volume type.
* `ebs_optimized` - Whether the Instance is EBS optimized or not (Boolean).
* `ephemeral_block_device` - The ephemeral block device mappings of the Instance.
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
* `device_name` - The physical name of the device.
* `no_device` - Whether the specified device included in the device mapping was suppressed or not (Boolean).
* `virtual_name` - The virtual device name.
* `iam_instance_profile` - The instance profile associated with the Instance. Specified as an ARN.
* `instance_type` - The type of the Instance.
* `key_name` - The key name of the Instance.
* `monitoring` - Whether detailed monitoring is enabled or disabled for the Instance (Boolean).
* `network_interface_id` - The ID of the network interface that was created with the Instance.
* `placement_group` - The placement group of the Instance.
* `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
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
for your VPC.
* `private_ip` - The private IP address assigned to the Instance.
* `public_dns` - The public DNS name assigned to the Instance. For EC2-VPC, this
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
is only available if you've enabled DNS hostnames for your VPC.
* `public_ip` - The public IP address assigned to the Instance, if applicable. **NOTE**: If you are using an [`aws_eip`](/docs/providers/aws/r/eip.html) 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.
* `root_block_device` - The root block device mappings of the Instance
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
* `delete_on_termination` - If the root block device will be deleted on termination.
* `iops` - `0` If the volume is not a provisioned IOPS image, otherwise the supported IOPS count.
* `volume_size` - The size of the volume, in GiB.
* `volume_type` - The type of the volume.
* `security_groups` - The associated security groups.
* `source_dest_check` - Whether the network interface performs source/destination checking (Boolean).
* `subnet_id` - The VPC subnet ID.
* `user_data` - The User Data supplied to the Instance.
* `tags` - A mapping of tags assigned to the Instance.
* `tenancy` - The tenancy of the instance: `dedicated`, `default`, `host`.
* `vpc_security_group_ids` - The associated security groups in a non-default VPC.
provider/aws: Add aws_instance data source Adds the `aws_instance` data source, tests, and documentation. ``` ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/18 11:49:09 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m === RUN TestAccAWSInstanceDataSource_basic --- PASS: TestAccAWSInstanceDataSource_basic (106.24s) === RUN TestAccAWSInstanceDataSource_AzUserData --- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s) === RUN TestAccAWSInstanceDataSource_gp2IopsDevice --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s) === RUN TestAccAWSInstanceDataSource_blockDevices --- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s) === RUN TestAccAWSInstanceDataSource_rootInstanceStore --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s) === RUN TestAccAWSInstanceDataSource_privateIP --- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s) === RUN TestAccAWSInstanceDataSource_keyPair --- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s) === RUN TestAccAWSInstanceDataSource_VPC --- PASS: TestAccAWSInstanceDataSource_VPC (109.89s) === RUN TestAccAWSInstanceDataSource_SecurityGroups --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s) === RUN TestAccAWSInstanceDataSource_VPCSecurityGroups --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 1300.625s ```
2017-01-18 18:19:44 +01:00
[1]: http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html