Skip to content

Latest commit

 

History

History

subnet-group

subnet-group

This module creates following resources.

  • aws_subnet
  • aws_dax_subnet_group (optional)
  • aws_db_subnet_group (optional)
  • aws_dms_replication_subnet_group (optional)
  • aws_docdb_subnet_group (optional)
  • aws_elasticache_subnet_group (optional)
  • aws_memorydb_subnet_group (optional)
  • aws_neptune_subnet_group (optional)
  • aws_redshift_subnet_group (optional)

Requirements

Name Version
terraform >= 1.6
aws >= 5.22

Providers

Name Version
aws 5.22.0

Modules

Name Source Version
resource_group tedilabs/misc/aws//modules/resource-group ~> 0.10.0
share tedilabs/account/aws//modules/ram-share ~> 0.27.0

Resources

Name Type
aws_dax_subnet_group.this resource
aws_db_subnet_group.this resource
aws_dms_replication_subnet_group.this resource
aws_docdb_subnet_group.this resource
aws_ec2_transit_gateway_vpc_attachment.this resource
aws_elasticache_subnet_group.this resource
aws_memorydb_subnet_group.this resource
aws_neptune_subnet_group.this resource
aws_redshift_subnet_group.this resource
aws_subnet.this resource
aws_availability_zones.available data source
aws_caller_identity.this data source
aws_ec2_transit_gateway.this data source

Inputs

Name Description Type Default Required
name (Required) The name of the subnet group. string n/a yes
subnets (Required) A configuration of subnets to create in the subnet group. Each block of subnets as defined below.
(Optional) type - The type of subnet. Valid values are DUALSTACK and IPV6. Defaults to DUALSTACK.
(Optional) availability_zone - The availability zone of the subnet. If the value of availability_zone and availability_zone_id are both not provided, the subnet will be created in random availability zone.
(Optional) availability_zone_id - The availability zone ID of the subnet. If the value of availability_zone and availability_zone_id are both not provided, the subnet will be created in random availability zone.
(Optional) ipv4_cidr - The IPv4 CIDR block for the subnet.
(Optional) ipv6_cidr - The IPv6 network range for the subnet, in CIDR notation. The subnet size must use a /64 prefix length.
map(object({
type = optional(string, "DUALSTACK")

availability_zone = optional(string)
availability_zone_id = optional(string)

ipv4_cidr = optional(string)
ipv6_cidr = optional(string)
}))
n/a yes
vpc_id (Required) The ID of the VPC which the subnet group belongs to. string n/a yes
customer_owned_ipv4_address_assignment (Optional) A configuration for Customer-owned IPv4 address assignment. customer_owned_ipv4_address_assignment as defined below.
(Optional) enabled - Whether to automatically request a Customer-owned IPv4 address for a new network interface in this subnet. Defaults to false.
(Optional) outpost - The Amazon Resource Name (ARN) of the Outpost.
(Optional) pool - The customer owned IPv4 address pool.
object({
enabled = optional(bool, false)
outpost = optional(string)
pool = optional(string)
})
{} no
dax_subnet_group (Optional) A configuration of DAX Subnet Group. dax_subnet_group as defined below.
(Optional) enabled - Whether to create DAX Subnet Group. Defaults to false.
(Optional) name - The name of the DAX Subnet Group. If not provided, the value of name will be used.
(Optional) description - The description of the DAX Subnet Group.
object({
enabled = optional(bool, false)
name = optional(string)
description = optional(string, "Managed by Terraform.")
})
{} no
dms_replication_subnet_group (Optional) A configuration of DMS Replication Subnet Group. dms_replication_subnet_group as defined below.
(Optional) enabled - Whether to create DMS Replication Subnet Group. Defaults to false.
(Optional) name - The name of the DMS Replication Subnet Group. If not provided, the value of name will be used.
(Optional) description - The description of the DMS Replication Subnet Group.
object({
enabled = optional(bool, false)
name = optional(string)
description = optional(string, "Managed by Terraform.")
})
{} no
dns_config (Optional) A configuration for DNS queries for the subnet. dns_config as defined below.
(Optional) hostname_type - The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID (RESOURCE_NAME). For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address (IP_NAME) or the instance ID (RESOURCE_NAME). Valid values are IP_NAME, RESOURCE_NAME. Defaults to RESOURCE_NAME.
(Optional) dns_resource_name_ipv4_enabled - Whether to respond to DNS queries for instance hostnames with DNS A records. Always false for IPv6 only subnet. Defaults to false.
(Optional) dns_resource_name_ipv6_enabled - Whether to respond to DNS queries for instance hostnames with DNS AAAA records. Always true for IPv6 only subnet. Defaults to false.
(Optional) dns64_enabled - Whether to enable DNS64 to allow IPv6-only services in Amazon VPC to communicate with IPv4-only services and networks. Defaults to false.
object({
hostname_type = optional(string, "RESOURCE_NAME")
dns_resource_name_ipv4_enabled = optional(bool, false)
dns_resource_name_ipv6_enabled = optional(bool, false)
dns64_enabled = optional(bool, false)
})
{} no
docdb_subnet_group (Optional) A configuration of DocumentDB Subnet Group. docdb_subnet_group as defined below.
(Optional) enabled - Whether to create DocumentDB Subnet Group. Defaults to false.
(Optional) name - The name of the DocumentDB Subnet Group. If not provided, the value of name will be used.
(Optional) description - The description of the DocumentDB Subnet Group.
object({
enabled = optional(bool, false)
name = optional(string)
description = optional(string, "Managed by Terraform.")
})
{} no
elasticache_subnet_group (Optional) A configuration of ElastiCache Subnet Group. elasticache_subnet_group as defined below.
(Optional) enabled - Whether to create ElastiCache Subnet Group. Defaults to false.
(Optional) name - The name of the ElastiCache Subnet Group. If not provided, the value of name will be used.
(Optional) description - The description of the ElastiCache Subnet Group.
object({
enabled = optional(bool, false)
name = optional(string)
description = optional(string, "Managed by Terraform.")
})
{} no
ipv6_address_assignment (Optional) A configuration for IPv6 address assignment. ipv6_address_assignment as defined below.
(Optional) enabled - Whether to automatically request a IPv6 address for a new network interface in this subnet. Defaults to false.
object({
enabled = optional(bool, false)
})
{} no
local_network_interface_device_index (Optional) The device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1). A local network interface cannot be the primary network interface (eth0). number null no
memorydb_subnet_group (Optional) A configuration of MemoryDB Subnet Group. memorydb_subnet_group as defined below.
(Optional) enabled - Whether to create MemoryDB Subnet Group. Defaults to false.
(Optional) name - The name of the MemoryDB Subnet Group. If not provided, the value of name will be used.
(Optional) description - The description of the MemoryDB Subnet Group.
object({
enabled = optional(bool, false)
name = optional(string)
description = optional(string, "Managed by Terraform.")
})
{} no
module_tags_enabled (Optional) Whether to create AWS Resource Tags for the module informations. bool true no
neptune_subnet_group (Optional) A configuration of Neptune Subnet Group. neptune_subnet_group as defined below.
(Optional) enabled - Whether to create Neptune Subnet Group. Defaults to false.
(Optional) name - The name of the Neptune Subnet Group. If not provided, the value of name will be used.
(Optional) description - The description of the Neptune Subnet Group.
object({
enabled = optional(bool, false)
name = optional(string)
description = optional(string, "Managed by Terraform.")
})
{} no
public_ipv4_address_assignment (Optional) A configuration for public IPv4 address assignment. public_ipv4_address_assignment as defined below.
(Optional) enabled - Whether to automatically request a public IPv4 address for a new network interface in this subnet. Defaults to false.
object({
enabled = optional(bool, false)
})
{} no
rds_subnet_group (Optional) A configuration of RDS Subnet Group. rds_subnet_group as defined below.
(Optional) enabled - Whether to create RDS Subnet Group. Defaults to false.
(Optional) name - The name of the RDS Subnet Group. If not provided, the value of name will be used.
(Optional) description - The description of the RDS Subnet Group.
object({
enabled = optional(bool, false)
name = optional(string)
description = optional(string, "Managed by Terraform.")
})
{} no
redshift_subnet_group (Optional) A configuration of Redshift Subnet Group. redshift_subnet_group as defined below.
(Optional) enabled - Whether to create Redshift Subnet Group. Defaults to false.
(Optional) name - The name of the Redshift Subnet Group. If not provided, the value of name will be used.
(Optional) description - The description of the Redshift Subnet Group.
object({
enabled = optional(bool, false)
name = optional(string)
description = optional(string, "Managed by Terraform.")
})
{} no
resource_group_description (Optional) The description of Resource Group. string "Managed by Terraform." no
resource_group_enabled (Optional) Whether to create Resource Group to find and group AWS resources which are created by this module. bool true no
resource_group_name (Optional) The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with AWS or aws. string "" no
shares (Optional) A list of resource shares via RAM (Resource Access Manager).
list(object({
name = optional(string)

permissions = optional(set(string), ["AWSRAMDefaultPermissionSubnet"])

external_principals_allowed = optional(bool, false)
principals = optional(set(string), [])

tags = optional(map(string), {})
}))
[] no
tags (Optional) A map of tags to add to all resources. map(string) {} no
timeouts (Optional) How long to wait for the subnet group to be created/deleted.
object({
create = optional(string, "10m")
delete = optional(string, "20m")
})
{} no
transit_gateway_attachments (Optional) A list of configurations for Transit Gateway VPC attachments. Each block of transit_gateway_attachments as defined below.
(Required) name - The name of the Transit Gateway VPC attachment.
(Required) transit_gateway - The ID of the Transit Gateway.
(Optional) appliance_mode_enabled - Whether Appliance Mode support is enabled. If enabled, a traffic flow between a source and destination uses the same Availability Zone for the VPC attachment for the lifetime of that flow. Defaults to false.
(Optional) dns_support_enabled - Whether to enable Domain Name System resolution for VPCs attached to this transit gateway. Defaults to true.
(Optional) ipv6_enabled - Whether to enable IPv6 support. Defaults to false.
(Optional) default_association_route_table_enabled - Whether to automatically associate transit gateway attachments with this transit gateway's default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Defaults to false.
(Optional) default_propagation_route_table_enabled - Whether to automatically propagate transit gateway attachments with this transit gateway's default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Defaults to false.
(Optional) tags - A map of tags to add to the vpc association.
list(object({
name = string
transit_gateway = string
appliance_mode_enabled = optional(bool, false)
dns_support_enabled = optional(bool, true)
ipv6_enabled = optional(bool, false)
default_association_route_table_enabled = optional(bool, false)
default_propagation_route_table_enabled = optional(bool, false)

tags = optional(map(string), {})
}))
[] no

Outputs

Name Description
arns A list of ARNs of subnets
availability_zone_ids A list of availability zone IDs which the subnet group uses.
availability_zones A list of availability zones which the subnet group uses.
customer_owned_ipv4_address_assignment The configuration of Customer-owned IPv4 address assignment.
enabled - Whether to automatically assign Customer-owned IPv4 address to instances launched in the subnet group.
outpost - The ARN of the Outpost.
pool - The ID of the Customer-owned IPv4 address pool.
dax_subnet_group The configuration of DAX Subnet Group.
id - The ID of the DAX Subnet Group.
name - The name of the DAX Subnet Group.
description - The description of the DAX Subnet Group.
dms_replication_subnet_group The configuration of DMS Replication Subnet Group.
id - The ID of the DMS Replication Subnet Group.
arn - The ARN of the DMS Replication Subnet Group.
name - The name of the DMS Replication Subnet Group.
description - The description of the DMS Replication Subnet Group.
dns_config The DNS configuration for the subnet group.
id - The ID of the DAX Subnet Group.
docdb_subnet_group The configuration of DocumentDB Subnet Group.
id - The ID of the DocumentDB Subnet Group.
arn - The ARN of the DocumentDB Subnet Group.
name - The name of the DocumentDB Subnet Group.
description - The description of the DocumentDB Subnet Group.
elasticache_subnet_group The configuration of ElastiCache Subnet Group.
id - The ID of the ElastiCache Subnet Group.
arn - The ARN of the ElastiCache Subnet Group.
name - The name of the ElastiCache Subnet Group.
description - The description of the ElastiCache Subnet Group.
ids A list of IDs of subnets
ipv4_cidrs The IPv4 CIDR blocks of the subnet group.
ipv6_address_assignment The configuration of IPv6 address assignment.
enabled - Whether to automatically assign IPv6 address to instances launched in the subnet group.
ipv6_cidrs The IPv6 CIDR blocks of the subnet group.
local_network_interface_device_index The device position for local network interfaces in this subnet.
memorydb_subnet_group The configuration of MemoryDB Subnet Group.
id - The ID of the MemoryDB Subnet Group.
arn - The ARN of the MemoryDB Subnet Group.
name - The name of the MemoryDB Subnet Group.
description - The description of the MemoryDB Subnet Group.
name The name of the subnet group.
neptune_subnet_group The configuration of Neptune Subnet Group.
id - The ID of the Neptune Subnet Group.
arn - The ARN of the Neptune Subnet Group.
name - The name of the Neptune Subnet Group.
description - The description of the Neptune Subnet Group.
owner The ID of the AWS account that owns subnets in the subnet group.
public_ipv4_address_assignment The configuration of public IPv4 address assignment.
enabled - Whether to automatically assign public IPv4 address to instances launched in the subnet group.
rds_subnet_group The configuration of RDS Subnet Group.
id - The ID of the RDS Subnet Group.
arn - The ARN of the RDS Subnet Group.
name - The name of the RDS Subnet Group.
description - The description of the RDS Subnet Group.
redshift_subnet_group The configuration of Redshift Subnet Group.
id - The ID of the Redshift Subnet Group.
arn - The ARN of the Redshift Subnet Group.
name - The name of the Redshift Subnet Group.
description - The description of the Redshift Subnet Group.
sharing The configuration for sharing of subnets in the subnet group.
status - An indication of whether subnets are shared with other AWS accounts, or was shared with the current account by another AWS account. Sharing is configured through AWS Resource Access Manager (AWS RAM). Values are NOT_SHARED, SHARED_BY_ME or SHARED_WITH_ME.
shares - The list of resource shares via RAM (Resource Access Manager).
subnets A list of subnets of the subnet group.
subnets_by_az A map of subnets of the subnet group which are grouped by availability zone id.
transit_gateway_attachments The configuration of Transit Gateway VPC attachments.
vpc_id The ID of the VPC which the subnet group belongs to.