Skip to content

Commit a963890

Browse files
committed
feat: Added networking layer for infrastructure.
1 parent 36bf087 commit a963890

File tree

6 files changed

+129
-0
lines changed

6 files changed

+129
-0
lines changed

tofu/config/networking/.terraform.lock.hcl

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tofu/config/networking/main.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
terraform {
2+
backend "s3" {
3+
bucket = "${var.project}-${var.environment}-tfstate"
4+
key = "networking.tfstate"
5+
region = var.region
6+
dynamodb_table = "${var.environment}.tfstate"
7+
}
8+
}
9+
10+
# TODO: Air gap this VPC from the internet.
11+
module "vpc" {
12+
source = "github.com/codeforamerica/tofu-modules-aws-vpc?ref=1.1.2"
13+
14+
project = var.project
15+
environment = var.environment
16+
cidr = var.vpc_cidr
17+
logging_key_id = var.logging_key_arn
18+
private_subnets = var.vpc_private_subnet_cidrs
19+
20+
# TODO: We don't need public subnets or a NAT gateway for an air gapped VPC.
21+
public_subnets = var.vpc_public_subnet_cidrs
22+
single_nat_gateway = true
23+
24+
tags = var.tags
25+
}

tofu/config/networking/outputs.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
output "vpc_id" {
2+
value = module.vpc.vpc_id
3+
description = "The ID of the VPC."
4+
}
5+
6+
output "private_subnets" {
7+
value = module.vpc.public_subnets
8+
description = "The IDs of the private subnets."
9+
}
10+
11+
output "public_subnets" {
12+
value = module.vpc.public_subnets
13+
description = "The IDs of the public subnets."
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
provider "aws" {
2+
region = var.region
3+
4+
default_tags {
5+
tags = {
6+
application = "${var.project}-${var.environment}"
7+
environment = var.environment
8+
program = var.program
9+
project = var.project
10+
}
11+
}
12+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
variable "environment" {
2+
type = string
3+
description = "Environment for the deployment."
4+
default = "development"
5+
}
6+
7+
variable "logging_key_arn" {
8+
type = string
9+
description = "The ARN of the KMS key for logging."
10+
}
11+
12+
variable "program" {
13+
type = string
14+
description = "Program the application belongs to."
15+
default = null
16+
}
17+
18+
variable "project" {
19+
type = string
20+
description = "Project that these resources are supporting."
21+
default = "sqs-senzing"
22+
}
23+
24+
variable "region" {
25+
type = string
26+
description = "AWS region where resources should be deployed."
27+
default = "us-west-1"
28+
}
29+
30+
variable "tags" {
31+
type = map(string)
32+
description = "Tags to apply to resources."
33+
default = {}
34+
}
35+
36+
variable "vpc_cidr" {
37+
type = string
38+
description = "CIDR block for the VPC."
39+
}
40+
41+
variable "vpc_private_subnet_cidrs" {
42+
type = list(string)
43+
description = "List of CIDR blocks for private subnets."
44+
}
45+
46+
variable "vpc_public_subnet_cidrs" {
47+
type = list(string)
48+
description = "List of CIDR blocks for public subnets."
49+
}

tofu/config/networking/versions.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 1.9"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 6.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)