Skip to content

Commit cd9070d

Browse files
lanzreinJohan Lanzrein
andauthored
Add support for network address usage metrics (#124)
Co-authored-by: Johan Lanzrein <jlanzrein@pictet.com>
1 parent 98d7624 commit cd9070d

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ Available targets:
248248
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
249249
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
250250
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
251+
| <a name="input_network_address_usage_metrics_enabled"></a> [network\_address\_usage\_metrics\_enabled](#input\_network\_address\_usage\_metrics\_enabled) | Set `true` to enable Network Address Usage Metrics for the VPC | `bool` | `false` | no |
251252
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
252253
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
253254
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
6868
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
6969
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
70+
| <a name="input_network_address_usage_metrics_enabled"></a> [network\_address\_usage\_metrics\_enabled](#input\_network\_address\_usage\_metrics\_enabled) | Set `true` to enable Network Address Usage Metrics for the VPC | `bool` | `false` | no |
7071
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
7172
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
7273
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |

examples/complete/fixtures.us-east-2.tfvars

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ stage = "test"
88

99
name = "vpc-subnets"
1010

11-
default_security_group_deny_all = true
12-
default_route_table_no_routes = true
13-
default_network_acl_deny_all = true
11+
default_security_group_deny_all = true
12+
default_route_table_no_routes = true
13+
default_network_acl_deny_all = true
14+
network_address_usage_metrics_enabled = true

examples/complete/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ module "vpc" {
2020

2121
assign_generated_ipv6_cidr_block = true
2222

23-
default_security_group_deny_all = var.default_security_group_deny_all
24-
default_route_table_no_routes = var.default_route_table_no_routes
25-
default_network_acl_deny_all = var.default_network_acl_deny_all
26-
27-
context = module.this.context
23+
default_security_group_deny_all = var.default_security_group_deny_all
24+
default_route_table_no_routes = var.default_route_table_no_routes
25+
default_network_acl_deny_all = var.default_network_acl_deny_all
26+
network_address_usage_metrics_enabled = var.network_address_usage_metrics_enabled
27+
context = module.this.context
2828
}
2929

3030
module "subnets" {

examples/complete/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ variable "default_route_table_no_routes" {
1717
variable "default_network_acl_deny_all" {
1818
type = bool
1919
}
20+
21+
variable "network_address_usage_metrics_enabled" {
22+
type = bool
23+
}

main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ resource "aws_vpc" "default" {
4141
ipv6_netmask_length = try(var.ipv6_primary_cidr_block_association.ipv6_netmask_length, null)
4242
# Additional IPv6 CIDRs are handled by aws_vpc_ipv6_cidr_block_association below
4343

44-
instance_tenancy = var.instance_tenancy
45-
enable_dns_hostnames = local.dns_hostnames_enabled
46-
enable_dns_support = local.dns_support_enabled
47-
assign_generated_ipv6_cidr_block = local.assign_generated_ipv6_cidr_block
48-
tags = module.label.tags
44+
instance_tenancy = var.instance_tenancy
45+
enable_dns_hostnames = local.dns_hostnames_enabled
46+
enable_dns_support = local.dns_support_enabled
47+
assign_generated_ipv6_cidr_block = local.assign_generated_ipv6_cidr_block
48+
enable_network_address_usage_metrics = var.network_address_usage_metrics_enabled
49+
tags = module.label.tags
4950
}
5051

5152
# If `aws_default_security_group` is not defined, it will be created implicitly with access `0.0.0.0/0`

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,9 @@ variable "ipv6_egress_only_internet_gateway_enabled" {
155155
description = "Set `true` to create an IPv6 Egress-Only Internet Gateway for the VPC"
156156
default = false
157157
}
158+
159+
variable "network_address_usage_metrics_enabled" {
160+
type = bool
161+
description = "Set `true` to enable Network Address Usage Metrics for the VPC"
162+
default = false
163+
}

0 commit comments

Comments
 (0)