This module is considered to be a data-only module. Given the name of a VPC and an optional set of availability zones, this module returns information about a VPC, such as public and private subnets, the VPC ID, etc. See the outputs file for which data is returned from this module. This module is useful for workspaces that require such information without declaring repetitive data
sources in your Terraform configurations.
The following example creates a security group and an application load balancer.
provider "aws" {}
module "networking" {
source = "github.com/mongodb-devprod-infrastructure/terraform-aws-networking-data-only"
vpc_name = "tutorial-vpc"
}
resource "aws_security_group" "this" {
ingress = [
{
cidr_blocks = ["0.0.0.0/0"]
from_port = 443
protocol = "TCP"
to_port = 443
}
]
vpc_id = module.networking.vpc_id
}
resource "aws_lb" "this" {
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.this.id]
subnets = module.networking.public_subnets
}
Name | Version |
---|---|
terraform | >= 1.0 |
aws | ~> 4 |
Name | Version |
---|---|
aws | ~> 4 |
No modules.
Name | Type |
---|---|
aws_availability_zones.this | data source |
aws_subnet.this | data source |
aws_subnets.this | data source |
aws_vpc.this | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
availability_zones | Select subnets only in the given AZs | set(string) |
[] |
no |
vpc_name | The name of the VPC | string |
n/a | yes |
Name | Description |
---|---|
dns_hostnames_enabled | Indicates if instances launched in this VPC will have public DNS hostnames |
dns_support_enabled | Indicates if DNS support is enabled for this VPC |
private_subnets | List of private subnets in this VPC |
public_subnets | List of public subnets in this VPC |
vpc_arn | Arn of this VPC |
vpc_cidr_block | CIDR range for this VPC |
vpc_cidr_blocks | All CIDR ranges for this VPC |
vpc_id | The ID of the VPC |
Please refer to the CONTRIBUTING document for more information.