This Terraform module creates a VPC (Virtual Private Cloud) infrastructure in Thalassa Cloud with support for public and private (no internet access) subnets, NAT Gateway, and route tables. It provides a flexible networking foundation for your cloud resources.
- Create a VPC with customizable CIDR blocks
- Deploy subnets with stretched network architecture
- Optional NAT Gateway deployment
- Configurable route tables for subnets
- Support for custom labels and descriptions
module "vpc" {
source = "thalassa-cloud/vpc/thalassa"
name = "my-vpc"
description = "Production VPC for my application"
organisation_id = "org-123456"
region = "nl-01"
vpc_cidrs = ["10.0.0.0/16"]
public_subnets = {
public-1 = {
cidr = "10.0.1.0/24"
description = "Public subnet"
labels = {
environment = "production"
tier = "public"
}
}
}
private_subnets = {
private-1 = {
cidr = "10.0.2.0/24"
description = "Private subnet"
labels = {
environment = "production"
tier = "private"
}
}
}
enable_nat_gateway = true
labels = {
environment = "production"
managed-by = "terraform"
}
}
The following requirements are needed by this module:
- thalassa (>= 0.6)
The following providers are used by this module:
- thalassa (0.6.0)
No modules.
The following resources are used by this module:
- thalassa_natgateway.this (resource)
- thalassa_route_table.private (resource)
- thalassa_route_table.public (resource)
- thalassa_route_table_route.public_default_route_via_natgw (resource)
- thalassa_subnet.private (resource)
- thalassa_subnet.public (resource)
- thalassa_vpc.this (resource)
The following input variables are required:
Description: The description of the VPC
Type: string
Description: The name of the VPC
Type: string
Description: The ID of the organisation to create the resources in. If not provided, the organisation set in the provider will be used.
Type: string
Description: n/a
Type: any
Description: n/a
Type: any
The following input variables are optional (have default values):
Description: Whether to deploy a NAT Gateway in the VPC
Type: bool
Default: false
Description: The labels to apply to the VPC
Type: map(string)
Default: {}
Description: The private subnets to create in the VPC. Private Subnets have no access to the internet.
Type:
map(object({
cidr = string
description = optional(string)
labels = optional(map(string))
}))
Default: {}
Description: The public subnets to create in the VPC. Public Subnets have access to the internet through a NAT Gateway.
Type:
map(object({
cidr = string
description = optional(string)
enable_nat_gateway = optional(bool)
labels = optional(map(string))
}))
Default: {}
Description: The region to create the VPC resources in
Type: string
Default: "nl-01"
Description: The CIDRs to create the VPC with
Type: list(string)
Default:
[
"10.0.0.0/16"
]
The following outputs are exported:
Description: Map of NAT gateway endpoint IPs by subnet key
Description: Map of NAT gateway slugs by subnet key
Description: Map of NAT gateway IPv4 addresses by subnet key
Description: Map of NAT gateway IPv6 addresses by subnet key
Description: Map of private subnet IDs by subnet key
Description: Map of private subnet slugs by subnet key
Description: Map of public subnet IDs by subnet key
Description: Map of public subnet slugs by subnet key
Description: Map of route table IDs by subnet key and type
Description: Map of all subnet slugs by subnet key and type
Description: The CIDR blocks of the VPC
Description: The ID of the VPC
Description: The slug of the VPC
Contributions are welcome! Please feel free to submit a Pull Request.
This module is released under the MIT License.