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
@@ -152,6 +153,10 @@ Since AWS Lambda functions allocate Elastic Network Interfaces in proportion to
152
153
153
154
You can add additional tags with `intra_subnet_tags` as with other subnet types.
154
155
156
+
## VPC Flow Log
157
+
158
+
VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).
159
+
155
160
## Conditional creation
156
161
157
162
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`.
@@ -206,6 +211,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
* 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)
211
217
@@ -214,7 +220,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
214
220
215
221
| Name | Version |
216
222
|------|---------|
217
-
| aws |~> 2.23|
223
+
| aws |~> 2.34|
218
224
219
225
## Inputs
220
226
@@ -263,6 +269,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
263
269
| create\_database\_subnet\_route\_table | Controls if separate route table for database should be created |`bool`|`false`| no |
264
270
| create\_elasticache\_subnet\_group | Controls if elasticache subnet group should be created |`bool`|`true`| no |
265
271
| create\_elasticache\_subnet\_route\_table | Controls if separate route table for elasticache should be created |`bool`|`false`| no |
272
+
| create\_flow\_log\_cloudwatch\_iam\_role | Whether to create IAM role for VPC Flow Logs |`bool`|`false`| no |
273
+
| create\_flow\_log\_cloudwatch\_log\_group | Whether to create CloudWatch log group for VPC Flow Logs |`bool`|`false`| no |
266
274
| create\_redshift\_subnet\_group | Controls if redshift subnet group should be created |`bool`|`true`| no |
267
275
| create\_redshift\_subnet\_route\_table | Controls if separate route table for redshift should be created |`bool`|`false`| no |
268
276
| create\_vpc | Controls if VPC should be created (it affects almost all resources) |`bool`|`true`| no |
@@ -358,6 +366,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
358
366
| enable\_efs\_endpoint | Should be true if you want to provision an EFS endpoint to the VPC |`bool`|`false`| no |
359
367
| enable\_elasticloadbalancing\_endpoint | Should be true if you want to provision a Elastic Load Balancing endpoint to the VPC |`bool`|`false`| no |
360
368
| enable\_events\_endpoint | Should be true if you want to provision a CloudWatch Events endpoint to the VPC |`bool`|`false`| no |
369
+
| enable\_flow\_log | Whether or not to enable VPC Flow Logs |`bool`|`false`| no |
361
370
| enable\_git\_codecommit\_endpoint | Should be true if you want to provision an Git Codecommit endpoint to the VPC |`bool`|`false`| no |
362
371
| enable\_glue\_endpoint | Should be true if you want to provision a Glue endpoint to the VPC |`bool`|`false`| no |
363
372
| enable\_ipv6 | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. |`bool`|`false`| no |
@@ -388,6 +397,14 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
388
397
| events\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Events endpoint |`list(string)`|`[]`| no |
389
398
| events\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Events endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. |`list(string)`|`[]`| no |
390
399
| external\_nat\_ip\_ids | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\_nat\_ips) |`list(string)`|`[]`| no |
400
+
| flow\_log\_cloudwatch\_iam\_role\_arn | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\_log\_destination\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided. |`string`|`""`| no |
401
+
| flow\_log\_cloudwatch\_log\_group\_kms\_key\_id | The ARN of the KMS Key to use when encrypting log data for VPC flow logs. |`string`| n/a | yes |
402
+
| flow\_log\_cloudwatch\_log\_group\_name\_prefix | Specifies the name prefix of CloudWatch Log Group for VPC flow logs. |`string`|`"/aws/vpc-flow-log/"`| no |
403
+
| flow\_log\_cloudwatch\_log\_group\_retention\_in\_days | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs. |`number`| n/a | yes |
404
+
| flow\_log\_destination\_arn | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\_flow\_log\_cloudwatch\_log\_group is set to false this argument must be provided. |`string`|`""`| no |
405
+
| flow\_log\_destination\_type | Type of flow log destination. Can be s3 or cloud-watch-logs. |`string`|`"cloud-watch-logs"`| no |
406
+
| flow\_log\_log\_format | The fields to include in the flow log record, in the order in which they should appear. |`string`| n/a | yes |
407
+
| flow\_log\_traffic\_type | The type of traffic to capture. Valid values: ACCEPT, REJECT, ALL. |`string`|`"ALL"`| no |
391
408
| git\_codecommit\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Git Codecommit endpoint |`bool`|`false`| no |
392
409
| git\_codecommit\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Git Codecommit endpoint |`list`|`[]`| no |
393
410
| git\_codecommit\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Git Codecommit endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. |`list`|`[]`| no |
@@ -509,6 +526,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
509
526
| transferserver\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Transfer Server endpoint |`list(string)`|`[]`| no |
510
527
| transferserver\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Transfer Server endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. |`list(string)`|`[]`| no |
511
528
| vpc\_endpoint\_tags | Additional tags for the VPC Endpoints |`map(string)`|`{}`| no |
529
+
| vpc\_flow\_log\_tags | Additional tags for the VPC Flow Logs |`map(string)`|`{}`| no |
512
530
| vpc\_tags | Additional tags for the VPC |`map(string)`|`{}`| no |
513
531
| vpn\_gateway\_id | ID of VPN Gateway to attach to the VPC |`string`|`""`| no |
514
532
| vpn\_gateway\_tags | Additional tags for the VPN gateway |`map(string)`|`{}`| no |
@@ -710,6 +728,10 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
710
728
| vpc\_endpoint\_transferserver\_dns\_entry | The DNS entries for the VPC Endpoint for transferserver. |
711
729
| vpc\_endpoint\_transferserver\_id | The ID of VPC endpoint for transferserver |
712
730
| vpc\_endpoint\_transferserver\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for transferserver |
731
+
| vpc\_flow\_log\_cloudwatch\_iam\_role\_arn | The ARN of the IAM role used when pushing logs to Cloudwatch log group |
732
+
| vpc\_flow\_log\_destination\_arn | The ARN of the destination for VPC Flow Logs |
733
+
| vpc\_flow\_log\_destination\_type | The type of the destination for VPC Flow Logs |
734
+
| vpc\_flow\_log\_id | The ID of the Flow Log resource |
713
735
| vpc\_id | The ID of the VPC |
714
736
| vpc\_instance\_tenancy | Tenancy of instances spin up within VPC |
715
737
| vpc\_ipv6\_association\_id | The association ID for the IPv6 CIDR block |
# VPC with enabled VPC flow log to S3 and CloudWatch logs
2
+
3
+
Configuration in this directory creates a set of VPC resources with VPC Flow Logs enabled in different configurations:
4
+
5
+
1.`cloud-watch-logs.tf` - Push logs to a new AWS CloudWatch Log group.
6
+
1.`cloud-watch-logs.tf` - Push logs to an existing AWS CloudWatch Log group using existing IAM role (created outside of this module).
7
+
1.`s3.tf` - Push logs to an existing S3 bucket (created outside of this module).
8
+
9
+
## Usage
10
+
11
+
To run this example you need to execute:
12
+
13
+
```bash
14
+
$ terraform init
15
+
$ terraform plan
16
+
$ terraform apply
17
+
```
18
+
19
+
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
+
## Providers
23
+
24
+
| Name | Version |
25
+
|------|---------|
26
+
| aws | n/a |
27
+
| random | n/a |
28
+
29
+
## Inputs
30
+
31
+
No input.
32
+
33
+
## Outputs
34
+
35
+
| Name | Description |
36
+
|------|-------------|
37
+
| vpc\_flow\_logs\_s3\_bucket\_vpc\_flow\_log\_destination\_arn | The ARN of the destination for VPC Flow Logs |
38
+
| vpc\_flow\_logs\_s3\_bucket\_vpc\_flow\_log\_destination\_type | The type of the destination for VPC Flow Logs |
39
+
| vpc\_flow\_logs\_s3\_bucket\_vpc\_flow\_log\_id | The ID of the Flow Log resource |
40
+
| vpc\_with\_flow\_logs\_cloudwatch\_logs\_default\_vpc\_flow\_log\_cloudwatch\_iam\_role\_arn | The ARN of the IAM role used when pushing logs to Cloudwatch log group |
41
+
| vpc\_with\_flow\_logs\_cloudwatch\_logs\_default\_vpc\_flow\_log\_destination\_arn | The ARN of the destination for VPC Flow Logs |
42
+
| vpc\_with\_flow\_logs\_cloudwatch\_logs\_default\_vpc\_flow\_log\_destination\_type | The type of the destination for VPC Flow Logs |
43
+
| vpc\_with\_flow\_logs\_cloudwatch\_logs\_default\_vpc\_flow\_log\_id | The ID of the Flow Log resource |
44
+
| vpc\_with\_flow\_logs\_cloudwatch\_logs\_vpc\_flow\_log\_cloudwatch\_iam\_role\_arn | The ARN of the IAM role used when pushing logs to Cloudwatch log group |
45
+
| vpc\_with\_flow\_logs\_cloudwatch\_logs\_vpc\_flow\_log\_destination\_arn | The ARN of the destination for VPC Flow Logs |
46
+
| vpc\_with\_flow\_logs\_cloudwatch\_logs\_vpc\_flow\_log\_destination\_type | The type of the destination for VPC Flow Logs |
47
+
| vpc\_with\_flow\_logs\_cloudwatch\_logs\_vpc\_flow\_log\_id | The ID of the Flow Log resource |
0 commit comments