Skip to content

Commit d20246e

Browse files
committed
docs/data-source/aws_subnet: Minor cleanup
1 parent e7fa342 commit d20246e

1 file changed

Lines changed: 32 additions & 50 deletions

File tree

website/docs/d/subnet.html.markdown

Lines changed: 32 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ description: |-
1010

1111
`aws_subnet` provides details about a specific VPC subnet.
1212

13-
This resource can prove useful when a module accepts a subnet id as
14-
an input variable and needs to, for example, determine the id of the
15-
VPC that the subnet belongs to.
13+
This resource can prove useful when a module accepts a subnet ID as an input variable and needs to, for example, determine the ID of the VPC that the subnet belongs to.
1614

1715
## Example Usage
1816

19-
The following example shows how one might accept a subnet id as a variable
20-
and use this data source to obtain the data necessary to create a security
21-
group that allows connections from hosts in that subnet.
17+
The following example shows how one might accept a subnet id as a variable and use this data source to obtain the data necessary to create a security group that allows connections from hosts in that subnet.
2218

2319
```hcl
2420
variable "subnet_id" {}
@@ -39,67 +35,53 @@ resource "aws_security_group" "subnet" {
3935
}
4036
```
4137

42-
## Argument Reference
43-
44-
The arguments of this data source act as filters for querying the available
45-
subnets in the current region. The given filters must match exactly one
46-
subnet whose data will be exported as attributes.
38+
### Filter Example
4739

48-
* `availability_zone` - (Optional) The availability zone where the
49-
subnet must reside.
50-
51-
* `availability_zone_id` - (Optional) The ID of the Availability Zone for the subnet.
40+
If you want to match against tag `Name`, use:
5241

53-
* `cidr_block` - (Optional) The cidr block of the desired subnet.
42+
```hcl
43+
data "aws_subnet" "selected" {
44+
filter {
45+
name = "tag:Name"
46+
values = ["yakdriver"]
47+
}
48+
}
49+
```
5450

55-
* `ipv6_cidr_block` - (Optional) The Ipv6 cidr block of the desired subnet
51+
## Argument Reference
5652

57-
* `default_for_az` - (Optional) Boolean constraint for whether the desired
58-
subnet must be the default subnet for its associated availability zone.
53+
The arguments of this data source act as filters for querying the available subnets in the current region. The given filters must match exactly one subnet whose data will be exported as attributes.
5954

60-
* `filter` - (Optional) Custom filter block as described below.
55+
The following arguments are optional:
6156

57+
* `availability_zone` - (Optional) The availability zone where the subnet must reside.
58+
* `availability_zone_id` - (Optional) The ID of the Availability Zone for the subnet.
59+
* `cidr_block` - (Optional) The cidr block of the desired subnet.
60+
* `default_for_az` - (Optional) Boolean constraint for whether the desired subnet must be the default subnet for its associated availability zone.
61+
* `filter` - (Optional) Configuration block. Detailed below.
6262
* `id` - (Optional) The id of the specific subnet to retrieve.
63-
63+
* `ipv6_cidr_block` - (Optional) The Ipv6 cidr block of the desired subnet
6464
* `state` - (Optional) The state that the desired subnet must have.
65-
66-
* `tags` - (Optional) A map of tags, each pair of which must exactly match
67-
a pair on the desired subnet.
68-
65+
* `tags` - (Optional) A map of tags, each pair of which must exactly match a pair on the desired subnet.
6966
* `vpc_id` - (Optional) The id of the VPC that the desired subnet belongs to.
7067

71-
More complex filters can be expressed using one or more `filter` sub-blocks,
72-
which take the following arguments:
68+
### filter
7369

74-
* `name` - (Required) The name of the field to filter by, as defined by
75-
[the underlying AWS API](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSubnets.html).
76-
For example, if matching against tag `Name`, use:
70+
This block allows for complex filters. You can use one or more `filter` blocks.
7771

78-
```hcl
79-
data "aws_subnet" "selected" {
80-
filter {
81-
name = "tag:Name"
82-
values = [""] # insert value here
83-
}
84-
}
85-
```
72+
The following arguments are required:
8673

87-
* `values` - (Required) Set of values that are accepted for the given field.
88-
A subnet will be selected if any one of the given values matches.
74+
* `name` - (Required) The name of the field to filter by, as defined by [the underlying AWS API](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSubnets.html).
75+
* `values` - (Required) Set of values that are accepted for the given field. A subnet will be selected if any one of the given values matches.
8976

9077
## Attributes Reference
9178

92-
All of the argument attributes except `filter` blocks are also exported as
93-
result attributes. This data source will complete the data by populating
94-
any fields that are not included in the configuration with the data for
95-
the selected subnet.
96-
97-
In addition the following attributes are exported:
79+
In addition to the attributes above, the following attributes are exported:
9880

99-
* `arn` - The ARN of the subnet.
81+
* `arn` - ARN of the subnet.
82+
* `available_ip_address_count` - Available IP addresses of the subnet.
10083
* `customer_owned_ipv4_pool` - Identifier of customer owned IPv4 address pool.
10184
* `map_customer_owned_ip_on_launch` - Whether customer owned IP addresses are assigned on network interface creation.
10285
* `map_public_ip_on_launch` - Whether public IP addresses are assigned on instance launch.
103-
* `available_ip_address_count` - The available IP addresses of the subnet.
104-
* `owner_id` - The ID of the AWS account that owns the subnet.
105-
* `outpost_arn` - The Amazon Resource Name (ARN) of the Outpost.
86+
* `outpost_arn` - ARN of the Outpost.
87+
* `owner_id` - ID of the AWS account that owns the subnet.

0 commit comments

Comments
 (0)