You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/d/subnet.html.markdown
+32-50Lines changed: 32 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,11 @@ description: |-
10
10
11
11
`aws_subnet` provides details about a specific VPC subnet.
12
12
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.
16
14
17
15
## Example Usage
18
16
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.
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
47
39
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:
52
41
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
+
```
54
50
55
-
*`ipv6_cidr_block` - (Optional) The Ipv6 cidr block of the desired subnet
51
+
## Argument Reference
56
52
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.
59
54
60
-
*`filter` - (Optional) Custom filter block as described below.
55
+
The following arguments are optional:
61
56
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.
This block allows for complex filters. You can use one or more `filter` blocks.
77
71
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:
86
73
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.
89
76
90
77
## Attributes Reference
91
78
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:
98
80
99
-
*`arn` - The ARN of the subnet.
81
+
*`arn` - ARN of the subnet.
82
+
*`available_ip_address_count` - Available IP addresses of the subnet.
100
83
*`customer_owned_ipv4_pool` - Identifier of customer owned IPv4 address pool.
101
84
*`map_customer_owned_ip_on_launch` - Whether customer owned IP addresses are assigned on network interface creation.
102
85
*`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