Skip to content

opsstation/terraform-aws-vpc-peering

Repository files navigation

terraform-aws-vpc-peering

AWS Infrastructure Provisioning with Terraform-aws-vpc-Peering module

Table of Contents

Introduction

This module is designed for peering two Amazon Virtual Private Clouds (VPCs) using AWS infrastructure. It provides a streamlined way to create a VPC peering connection between two VPCs in the eu-west-1 region. The module is customizable and can be easily integrated into your Terraform infrastructure.

Usage

To use this module, you should have Terraform installed and configured for AWS. This module provides the necessary Terraform configuration for creating AWS resources, and you can customize the inputs as needed. Below is an example of how to use this module## examples

Example: default

module "vpc-peering" {
  source           = "git::https://github.com/opsstation/terraform-aws-vpc-peering.git?ref=v1.0.0"
  name             = local.name
  environment      = local.environment
  requestor_vpc_id = "vpc-0d17e09526dd116c4"
  acceptor_vpc_id  = "vpc-0ace2232c2c10bc28"
}

Example: multi-region

module "vpc-peering" {
  source           = "git::https://github.com/opsstation/terraform-aws-vpc-peering.git?ref=v1.0.0"
  name             = "vpc-peering"
  environment      = "prod"
  label_order      = ["environment", "name"]
  requestor_vpc_id = "vpc-0408156477974f013"
  acceptor_vpc_id  = "vpc-07fca4b652df66412"
  accept_region    = "us-east-1"
  auto_accept      = false
}

Examples

For detailed examples on how to use this module, please refer to the examples directory within this repository.

License

This Terraform module is provided under the '[License Name]' License. Please see the LICENSE file for more details.

Author

Your Name Replace '[License Name]' and '[Your Name]' with the appropriate license and your information. Feel free to expand this README with additional details or usage instructions as needed for your specific use case.

Requirements

Name Version
terraform >= 1.6.1
aws >= 5.21.0

Providers

Name Version
aws >= 5.21.0
aws.peer >= 5.21.0

Modules

Name Source Version
labels git::https://github.com/opsstation/terraform-aws-labels.git v1.0.0

Resources

Name Type
aws_route.acceptor resource
aws_route.acceptor-region resource
aws_route.requestor resource
aws_route.requestor-region resource
aws_vpc_peering_connection.default resource
aws_vpc_peering_connection.region resource
aws_vpc_peering_connection_accepter.peer resource
aws_caller_identity.current data source
aws_region.default data source
aws_route_tables.acceptor data source
aws_route_tables.requestor data source
aws_vpc.acceptor data source
aws_vpc.requestor data source

Inputs

Name Description Type Default Required
accept_region The region of the accepter VPC of the VPC Peering Connection. string "" no
acceptor_allow_remote_vpc_dns_resolution Allow acceptor VPC to resolve public DNS hostnames to private IP addresses when queried from instances in the requestor VPC. bool true no
acceptor_vpc_id Acceptor VPC ID. string n/a yes
auto_accept Automatically accept the peering (both VPCs need to be in the same AWS account). bool true no
enable_peering Set to false to prevent the module from creating or accessing any resources. bool true no
environment Environment (e.g. prod, dev, staging). string "" no
label_order Label order, e.g. name,Environment. list(any)
[
"name",
"environment"
]
no
managedby ManagedBy, eg 'opsstation'. string "opsstation" no
name Name (e.g. app or cluster). string "" no
repository Terraform current module repo string "https://github.com/opsstation/terraform-aws-vpc-peering" no
requestor_allow_remote_vpc_dns_resolution Allow requestor VPC to resolve public DNS hostnames to private IP addresses when queried from instances in the acceptor VPC. bool true no
requestor_vpc_id Requestor VPC ID. string n/a yes

Outputs

Name Description
accept_status The status of the VPC peering connection request.
connection_id VPC peering connection ID.
tags A mapping of tags to assign to the resource.