Professional Documents
Culture Documents
Aws Global Networking in Terraform 21221643211015636
Aws Global Networking in Terraform 21221643211015636
Aws Global Networking in Terraform 21221643211015636
Introduction to Terraform
What is Hashicorp Terraform?
Click to edit Master title style
Terraform is an infrastructure as code (IaC) tool that allows
you to build, change, and version infrastructure safely and
efficiently.
This includes low-level components such as compute
instances, storage, and networking, as well as high-level
components such as DNS entries, SaaS features, etc.
Terraform can manage both existing service providers and
custom in-house solutions.
Relevant Terraform Constructs
Click to edit Master title style
Resources Variables Modules Outputs Backend
Hardcoded
Parameters
Obfuscation of values or
which can
All object the dirty work properties of
make Location of
types that are of creating created
templates state files and
created in a multiple objects which
reusable while lockfile
terraform related can be
consolidating storage
template. resources of queried using
hardcoded
different types the backend
values
state objects
Terraform in AWS (SPoF)
Click to edit Master title style
AWS Cloud
Client provisions
or modifies AWS
resources via
Terraform
Terraform in AWS (SPoF)
Click to edit Master title style
AWS Cloud
Lockfile prevents
multiple actions
from same client
Terraform in AWS (SPoF)
Click to edit Master title style
AWS Cloud
Resource state
and outputs are
stored on the
client
Terraform in AWS (SPoF)
Click to edit Master title style
AWS Cloud
Nor is this a
resilient design,
by any measure
Terraform in AWS (Resilient)
Click to edit Master title style
AWS Cloud
Public subnet
Requirement Translation to Features
Click to edit Master title style
Internal-only Applications
Private subnet
Requirement Translation to Features
Click to edit Master title style
Geographic Separation (For Business
Continuity)
Region Region
Region
Requirement Translation to Features
Click to edit Master title style
Highly Available
Region
VPC
Single Region Network Diagram
Click to edit Master title style
Region
VPC
Single Region Network Diagram
Click to edit Master title style
Region
VPC
VPC
Internet gateway
VPC
Internet gateway
Gateway
NAT gateway NAT gateway NAT gateway Endpoints
Single-Region Network
Deployment
Terraform VPC Resources (Atomic)
Click to edit Master title style
All of these require
● VPC object several parameters,
● Subnet(s) many of which are
redundant from one
● IGW resource to the next
VPC ● IGW attachment
● NAT GW(s)
● NAT GW EIP(s)
● Route table(s)
● RT attachment(s)
● Tag(s)
Terraform VPC Module
Click to edit Master title style
The module takes
care of all the
● CIDR atomic elements
with a single set of
● AZs parameters
● Public subnets
VPC
● Private subnets
● NAT GW #s
● Tags
Demonstration
Click to edit Master title style
Deploy a single-region VPC
Click to edit Master title style
● Attach to subnet
● Region scoped
● Standalone resource
● Connect to VPCs
● Connect to on-prem
networks
Transit Gateway Provisioning
Click to edit Master title style
Transit Gateway can be
deployed as a standalone
resource
Transit Gateway Attachments
Click to edit Master title style
VPC
Attachments can be
Public subnet
created into subnets in a
VPC
Private subnet
Transit Gateway Attachments
Click to edit Master title style
VPC
Route table entries are
Public subnet
also required for each
subnet
Private subnet
Transit Gateway Attachments
Click to edit Master title style
VPC VPC
Public subnet
Public subnet
Connect an on-premises
Private subnet data center via VPN
Corporate
data center
Transit Gateway Attachments
Click to edit Master title style
VPC VPC
Public subnet
Private subnet
● TGW
● TGW VPC
attachments
● TGW routes
● Tags
What is missing from the module?
Click to edit Master title style
Because of all these
missing elements, it
makes sense to
● Cross-region peers make OUR OWN
module!
● Cross-region TGW
route table entries
● VPC route table
entries
Demonstration
Click to edit Master title style
Create a Transit Gateway module in
Terraform
Click to edit Master title style
Multi-Region Network
Connectivity using Transit
Gateway
Transit Gateway Attachments
Click to edit Master title style
Region Region Connect Transit Gateways
to each other via cross-
region VPN
Multi-Region Network
Connectivity using VPC Peering
VPC Peering Basics
Click to edit Master title style
● Attach 2 VPC
networks
● Same region
● Same account
● Cross region
● Cross account
● No overlapping CIDR
VPC Peering Configuration
Click to edit Master title style
VPC VPC
Add route
table entry in
both VPCs
VPC Peering vs TGW Comparison
Click to edit Master title style
VPCp TGWp
Auto SR accept
VPC Peering vs TGW Comparison
Click to edit Master title style
VPCp TGWp
Auto SR accept
Auto CR accept
VPC Peering vs TGW Comparison
Click to edit Master title style
VPCp TGWp
Auto SR accept
Auto CR accept
Auto SR accept
Auto CR accept
Attach to subnet
VPC Peering vs TGW Comparison
Click to edit Master title style
VPCp TGWp
Auto SR accept
Auto CR accept
Attach to subnet
Auto SR accept
Auto CR accept
Attach to subnet
Auto SR accept
Auto CR accept
Attach to subnet
Auto SR accept
Auto CR accept
Attach to subnet
Auto SR accept
Auto CR accept
Attach to subnet(s)
Monitoring
VPC Peering vs TGW Comparison
Click to edit Master title style
VPCp TGWp
Auto SR accept
Auto CR accept
Attach to subnet(s)
Monitoring
What about Terraform VPC Peering?
Click to edit Master title style
Let's create a small
module for handling
route table entries
for accepter and
● Same-region peers requestor
● Cross-region peers
● Does NOT handle
route table entries!
Demonstration
Click to edit Master title style
De-provision Transit Gateway and
replace with VPC Peering
Click to edit Master title style
Wrap up and QA