Skip to content

Commit 4935e47

Browse files
Lukasz StadnikSlawomir Kaczmarek
Lukasz Stadnik
authored and
Slawomir Kaczmarek
committed
feat(module/subnet_set): ma_public_ip_on_launch per subnet
1 parent 5df370f commit 4935e47

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

modules/subnet_set/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ No modules.
6363

6464
| Name | Description | Type | Default | Required |
6565
|------|-------------|------|---------|:--------:|
66-
| <a name="input_cidrs"></a> [cidrs](#input\_cidrs) | Map describing configuration of subnets and route tables to create and/or use in the set.<br>Keys are CIDR blocks, values can consist of following items:<br>- `create_subnet` - (Optional\|bool) When `true` (default), subnet is created, otherwise existing one is used.<br>- `create_route_table` - (Optional\|bool) When `true` a dedicated route table is created, unless existing subnet is used.<br>- `associate_route_table` - (Optional\|bool) Unless set to `false`, route table is associated with the subnet.<br>- `existing_route_table_id` - (Optional\|string) Id of an existing route table to associate with the subnet.<br>- `name` - (Optional\|string) Name (tag) of a subnet and, optionally a route table, to create or use. Defaults to set name appended with zone letter id.<br>- `route_table_name` - (Optional\|string) Name (tag) of a subnet and, optionally a route table, to create or use. Defaults to `name` value.<br>- `ipv6_cidr_block` - (Optional\|string) IPv6 CIDR block. The subnet size must use a /64 prefix length.<br>- `local_tags` - (Optional\|map) Map of tags to assign to created resources. | `map(any)` | n/a | yes |
66+
| <a name="input_cidrs"></a> [cidrs](#input\_cidrs) | Map describing configuration of subnets and route tables to create and/or use in the set.<br>Keys are CIDR blocks, values can consist of following items:<br>- `create_subnet` - (Optional\|bool) When `true` (default), subnet is created, otherwise existing one is used.<br>- `create_route_table` - (Optional\|bool) When `true` a dedicated route table is created, unless existing subnet is used.<br>- `associate_route_table` - (Optional\|bool) Unless set to `false`, route table is associated with the subnet.<br>- `existing_route_table_id` - (Optional\|string) Id of an existing route table to associate with the subnet.<br>- `name` - (Optional\|string) Name (tag) of a subnet and, optionally a route table, to create or use. Defaults to set name appended with zone letter id.<br>- `route_table_name` - (Optional\|string) Name (tag) of a subnet and, optionally a route table, to create or use. Defaults to `name` value.<br>- `ipv6_cidr_block` - (Optional\|string) IPv6 CIDR block. The subnet size must use a /64 prefix length.<br>- `map_public_ip_on_launch` - (Optional\|bool) Specify true to indicate that instances launched into the subnet should be assigned a public IP address.<br>- `local_tags` - (Optional\|map) Map of tags to assign to created resources. | `map(any)` | n/a | yes |
6767
| <a name="input_create_shared_route_table"></a> [create\_shared\_route\_table](#input\_create\_shared\_route\_table) | Boolean flag whether to create a shared route tables. | `bool` | `false` | no |
6868
| <a name="input_global_tags"></a> [global\_tags](#input\_global\_tags) | Optional map of arbitrary tags to apply to all the created resources. | `map(string)` | `{}` | no |
6969
| <a name="input_has_secondary_cidrs"></a> [has\_secondary\_cidrs](#input\_has\_secondary\_cidrs) | The input that depends on the secondary CIDR ranges of the VPC `vpc_id`. The actual value (true or false) is ignored, the input is used only to delay subnet creation until the secondary CIDR ranges are processed by Terraform. | `bool` | `true` | no |
70-
| <a name="input_map_public_ip_on_launch"></a> [map\_public\_ip\_on\_launch](#input\_map\_public\_ip\_on\_launch) | See the [provider's documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet#map_public_ip_on_launch). | `bool` | `null` | no |
7170
| <a name="input_nacl_associations"></a> [nacl\_associations](#input\_nacl\_associations) | NACLs associations with subnets | `map(string)` | `{}` | no |
7271
| <a name="input_name"></a> [name](#input\_name) | Subnet set name, used to construct default subnet names. | `string` | `null` | no |
7372
| <a name="input_propagating_vgws"></a> [propagating\_vgws](#input\_propagating\_vgws) | See the [provider's documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table). | `list(string)` | `[]` | no |

modules/subnet_set/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ resource "aws_subnet" "this" {
3838
ipv6_cidr_block = try(each.value.ipv6_cidr_block, null)
3939
availability_zone = each.key
4040
vpc_id = var.vpc_id
41-
map_public_ip_on_launch = var.map_public_ip_on_launch
41+
map_public_ip_on_launch = try(each.value.map_public_ip_on_launch, null)
4242
tags = merge(var.global_tags, each.value.local_tags, { Name = each.value.name })
4343

4444
depends_on = [

modules/subnet_set/variables.tf

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ variable "cidrs" {
1515
- `name` - (Optional|string) Name (tag) of a subnet and, optionally a route table, to create or use. Defaults to set name appended with zone letter id.
1616
- `route_table_name` - (Optional|string) Name (tag) of a subnet and, optionally a route table, to create or use. Defaults to `name` value.
1717
- `ipv6_cidr_block` - (Optional|string) IPv6 CIDR block. The subnet size must use a /64 prefix length.
18+
- `map_public_ip_on_launch` - (Optional|bool) Specify true to indicate that instances launched into the subnet should be assigned a public IP address.
1819
- `local_tags` - (Optional|map) Map of tags to assign to created resources.
1920
EOF
2021
type = map(any)
@@ -31,12 +32,6 @@ variable "create_shared_route_table" {
3132
type = bool
3233
}
3334

34-
variable "map_public_ip_on_launch" {
35-
description = "See the [provider's documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet#map_public_ip_on_launch)."
36-
default = null
37-
type = bool
38-
}
39-
4035
variable "propagating_vgws" {
4136
description = "See the [provider's documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table)."
4237
default = []

0 commit comments

Comments
 (0)