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
[](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)
5
4
@@ -21,8 +20,7 @@ These types of resources are supported:
By default this module will provision new Elastic IPs for the VPC's NAT Gateways.
52
49
This means that when creating a new VPC, new IPs are allocated, and when that VPC is destroyed those IPs are released.
@@ -81,8 +78,7 @@ Note that in the example we allocate 3 IPs because we will be provisioning 3 NAT
81
78
If, on the other hand, `single_nat_gateway = true`, then `aws_eip.nat` would only need to allocate 1 IP.
82
79
Passing the IPs into the module is done by setting two variables `reuse_nat_ips = true` and `external_nat_ip_ids = ["${aws_eip.nat.*.id}"]`.
83
80
84
-
Conditional creation
85
-
--------------------
81
+
## Conditional creation
86
82
87
83
Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.
88
84
@@ -96,22 +92,122 @@ module "vpc" {
96
92
}
97
93
```
98
94
99
-
Terraform version
100
-
-----------------
95
+
## Terraform version
101
96
102
97
Terraform version 0.10.3 or newer is required for this module to work.
* Few tests and edge cases examples: [#46](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/issue-46-no-private-subnets), [#44](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/issue-44-asymmetric-private-subnets), [#108](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/issue-108-route-already-exists)
111
105
112
-
113
-
Tests
114
-
-------
106
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
107
+
108
+
## Inputs
109
+
110
+
| Name | Description | Type | Default | Required |
111
+
|------|-------------|:----:|:-----:|:-----:|
112
+
| azs | A list of availability zones in the region | string |`<list>`| no |
113
+
| cidr | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overriden | string |`0.0.0.0/0`| no |
114
+
| create_database_subnet_group | Controls if database subnet group should be created | string |`true`| no |
115
+
| create_vpc | Controls if VPC should be created (it affects almost all resources) | string |`true`| no |
116
+
| database_subnet_tags | Additional tags for the database subnets | string |`<map>`| no |
117
+
| database_subnets | A list of database subnets | list |`<list>`| no |
118
+
| default_route_table_tags | Additional tags for the default route table | string |`<map>`| no |
119
+
| default_vpc_enable_classiclink | Should be true to enable ClassicLink in the Default VPC | string |`false`| no |
120
+
| default_vpc_enable_dns_hostnames | Should be true to enable DNS hostnames in the Default VPC | string |`false`| no |
121
+
| default_vpc_enable_dns_support | Should be true to enable DNS support in the Default VPC | string |`true`| no |
122
+
| default_vpc_name | Name to be used on the Default VPC | string | `` | no |
123
+
| default_vpc_tags | Additional tags for the Default VPC | string |`<map>`| no |
124
+
| dhcp_options_domain_name | Specifies DNS name for DHCP options set | string | `` | no |
125
+
| dhcp_options_domain_name_servers | Specify a list of DNS server addresses for DHCP options set, default to AWS provided | list |`<list>`| no |
126
+
| dhcp_options_netbios_name_servers | Specify a list of netbios servers for DHCP options set | list |`<list>`| no |
127
+
| dhcp_options_netbios_node_type | Specify netbios node_type for DHCP options set | string | `` | no |
128
+
| dhcp_options_ntp_servers | Specify a list of NTP servers for DHCP options set | list |`<list>`| no |
129
+
| dhcp_options_tags | Additional tags for the DHCP option set | string |`<map>`| no |
130
+
| elasticache_subnet_tags | Additional tags for the elasticache subnets | string |`<map>`| no |
131
+
| elasticache_subnets | A list of elasticache subnets | list |`<list>`| no |
132
+
| enable_dhcp_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | string |`false`| no |
133
+
| enable_dns_hostnames | Should be true to enable DNS hostnames in the VPC | string |`false`| no |
134
+
| enable_dns_support | Should be true to enable DNS support in the VPC | string |`true`| no |
135
+
| enable_dynamodb_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | string |`false`| no |
136
+
| enable_nat_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | string |`false`| no |
137
+
| enable_s3_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | string |`false`| no |
138
+
| enable_vpn_gateway | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | string |`false`| no |
139
+
| external_nat_ip_ids | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse_nat_ips) | list |`<list>`| no |
140
+
| instance_tenancy | A tenancy option for instances launched into the VPC | string |`default`| no |
141
+
| manage_default_vpc | Should be true to adopt and manage Default VPC | string |`false`| no |
142
+
| map_public_ip_on_launch | Should be false if you do not want to auto-assign public IP on launch | string |`true`| no |
143
+
| name | Name to be used on all the resources as identifier | string | `` | no |
144
+
| private_route_table_tags | Additional tags for the private route tables | string |`<map>`| no |
145
+
| private_subnet_tags | Additional tags for the private subnets | string |`<map>`| no |
146
+
| private_subnets | A list of private subnets inside the VPC | string |`<list>`| no |
147
+
| propagate_private_route_tables_vgw | Should be true if you want route table propagation | string |`false`| no |
148
+
| propagate_public_route_tables_vgw | Should be true if you want route table propagation | string |`false`| no |
149
+
| public_route_table_tags | Additional tags for the public route tables | string |`<map>`| no |
150
+
| public_subnet_tags | Additional tags for the public subnets | string |`<map>`| no |
151
+
| public_subnets | A list of public subnets inside the VPC | string |`<list>`| no |
152
+
| redshift_subnet_tags | Additional tags for the redshift subnets | string |`<map>`| no |
153
+
| redshift_subnets | A list of redshift subnets | list |`<list>`| no |
154
+
| reuse_nat_ips | Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external_nat_ip_ids' variable | string |`false`| no |
155
+
| single_nat_gateway | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | string |`false`| no |
156
+
| tags | A map of tags to add to all resources | string |`<map>`| no |
157
+
| vpc_tags | Additional tags for the VPC | string |`<map>`| no |
158
+
| vpn_gateway_id | ID of VPN Gateway to attach to the VPC | string | `` | no |
159
+
160
+
## Outputs
161
+
162
+
| Name | Description |
163
+
|------|-------------|
164
+
| database_subnet_group | ID of database subnet group |
165
+
| database_subnets | List of IDs of database subnets |
166
+
| database_subnets_cidr_blocks | List of cidr_blocks of database subnets |
167
+
| default_network_acl_id | The ID of the default network ACL |
168
+
| default_route_table_id | The ID of the default route table |
169
+
| default_security_group_id | The ID of the security group created by default on VPC creation |
170
+
| default_vpc_cidr_block | The CIDR block of the VPC |
171
+
| default_vpc_default_network_acl_id | The ID of the default network ACL |
172
+
| default_vpc_default_route_table_id | The ID of the default route table |
173
+
| default_vpc_default_security_group_id | The ID of the security group created by default on VPC creation |
174
+
| default_vpc_enable_dns_hostnames | Whether or not the VPC has DNS hostname support |
175
+
| default_vpc_enable_dns_support | Whether or not the VPC has DNS support |
176
+
| default_vpc_id | Default VPC |
177
+
| default_vpc_instance_tenancy | Tenancy of instances spin up within VPC |
178
+
| default_vpc_main_route_table_id | The ID of the main route table associated with this VPC |
179
+
| elasticache_subnet_group | ID of elasticache subnet group |
180
+
| elasticache_subnet_group_name | Name of elasticache subnet group |
181
+
| elasticache_subnets | List of IDs of elasticache subnets |
182
+
| elasticache_subnets_cidr_blocks | List of cidr_blocks of elasticache subnets |
183
+
| igw_id | Internet Gateway |
184
+
| nat_ids | List of allocation ID of Elastic IPs created for AWS NAT Gateway |
185
+
| nat_public_ips | List of public Elastic IPs created for AWS NAT Gateway |
186
+
| natgw_ids | List of NAT Gateway IDs |
187
+
| private_route_table_ids | List of IDs of private route tables |
188
+
| private_subnets | Subnets |
189
+
| private_subnets_cidr_blocks | List of cidr_blocks of private subnets |
190
+
| public_route_table_ids | Route tables |
191
+
| public_subnets | List of IDs of public subnets |
192
+
| public_subnets_cidr_blocks | List of cidr_blocks of public subnets |
193
+
| redshift_subnet_group | ID of redshift subnet group |
194
+
| redshift_subnets | List of IDs of redshift subnets |
195
+
| redshift_subnets_cidr_blocks | List of cidr_blocks of redshift subnets |
196
+
| vgw_id | VPN Gateway |
197
+
| vpc_cidr_block | The CIDR block of the VPC |
198
+
| vpc_enable_dns_hostnames | Whether or not the VPC has DNS hostname support |
199
+
| vpc_enable_dns_support | Whether or not the VPC has DNS support |
200
+
| vpc_endpoint_dynamodb_id | The ID of VPC endpoint for DynamoDB |
201
+
| vpc_endpoint_dynamodb_pl_id | The prefix list for the DynamoDB VPC endpoint. |
202
+
| vpc_endpoint_s3_id | VPC Endpoints |
203
+
| vpc_endpoint_s3_pl_id | The prefix list for the S3 VPC endpoint. |
204
+
| vpc_id | VPC |
205
+
| vpc_instance_tenancy | Tenancy of instances spin up within VPC |
206
+
| vpc_main_route_table_id | The ID of the main route table associated with this VPC |
207
+
208
+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
209
+
210
+
## Tests
115
211
116
212
This module has been packaged with [awspec](https://github.com/k1LoW/awspec) tests through test kitchen. To run them:
3. Test using `bundle exec kitchen test` from the root of the repo.
124
220
125
221
126
-
Authors
127
-
-------
222
+
## Authors
128
223
129
224
Migrated from `terraform-community-modules/tf_aws_vpc`, where it was maintained by [these awesome contributors](https://github.com/terraform-community-modules/tf_aws_vpc/graphs/contributors).
130
225
Module managed by [Anton Babenko](https://github.com/antonbabenko).
Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).
5
4
6
5
There are public, private, database, ElastiCache subnets, NAT Gateways created in each availability zone.
7
6
8
-
Usage
9
-
=====
7
+
## Usage
10
8
11
9
To run this example you need to execute:
12
10
@@ -17,3 +15,19 @@ $ terraform apply
17
15
```
18
16
19
17
Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.
18
+
19
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
20
+
21
+
## Outputs
22
+
23
+
| Name | Description |
24
+
|------|-------------|
25
+
| database_subnets | List of IDs of database subnets |
26
+
| elasticache_subnets | List of IDs of elasticache subnets |
27
+
| nat_public_ips | NAT gateways |
28
+
| private_subnets | Subnets |
29
+
| public_subnets | List of IDs of public subnets |
30
+
| redshift_subnets | List of IDs of redshift subnets |
Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.
20
+
21
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
22
+
23
+
## Outputs
24
+
25
+
| Name | Description |
26
+
|------|-------------|
27
+
| database_subnets | List of IDs of database subnets |
28
+
| elasticache_subnets | List of IDs of elasticache subnets |
29
+
| nat_public_ips | NAT gateways |
30
+
| private_subnets | Subnets |
31
+
| public_subnets | List of IDs of public subnets |
Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.
18
+
19
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
20
+
21
+
## Outputs
22
+
23
+
| Name | Description |
24
+
|------|-------------|
25
+
| database_subnets | List of IDs of database subnets |
26
+
| elasticache_subnets | List of IDs of elasticache subnets |
27
+
| nat_public_ips | NAT gateways |
28
+
| private_subnets | Subnets |
29
+
| public_subnets | List of IDs of public subnets |
Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.
18
+
19
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
20
+
21
+
## Outputs
22
+
23
+
| Name | Description |
24
+
|------|-------------|
25
+
| database_subnets | List of IDs of database subnets |
26
+
| elasticache_subnets | List of IDs of elasticache subnets |
27
+
| nat_public_ips | NAT gateways |
28
+
| private_subnets | Subnets |
29
+
| public_subnets | List of IDs of public subnets |
Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.
5
4
6
5
This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).
7
6
8
-
Usage
9
-
=====
7
+
## Usage
10
8
11
9
To run this example you need to execute:
12
10
@@ -17,3 +15,14 @@ $ terraform apply
17
15
```
18
16
19
17
Run `terraform destroy` when you don't need these resources.
18
+
19
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
20
+
21
+
## Outputs
22
+
23
+
| Name | Description |
24
+
|------|-------------|
25
+
| default_vpc_cidr_block | The CIDR block of the VPC |
Configuration in this directory creates set of VPC resources which may be sufficient for development environment.
5
4
6
5
There is a public and private subnet created per availability zone in addition to single NAT Gateway shared between all 3 availability zones.
7
6
8
-
Usage
9
-
=====
7
+
## Usage
10
8
11
9
To run this example you need to execute:
12
10
@@ -17,3 +15,16 @@ $ terraform apply
17
15
```
18
16
19
17
Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.
18
+
19
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
20
+
21
+
## Outputs
22
+
23
+
| Name | Description |
24
+
|------|-------------|
25
+
| nat_public_ips | NAT gateways |
26
+
| private_subnets | Subnets |
27
+
| public_subnets | List of IDs of public subnets |
0 commit comments