Skip to content

Commit 410a865

Browse files
committed
feat: Added service layer for infrastructure.
1 parent a963890 commit 410a865

File tree

8 files changed

+148
-1
lines changed

8 files changed

+148
-1
lines changed

tofu/config/service/.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/service/main.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
terraform {
2+
backend "s3" {
3+
bucket = "${var.project}-${var.environment}-tfstate"
4+
key = "service.tfstate"
5+
region = var.region
6+
dynamodb_table = "${var.environment}.tfstate"
7+
}
8+
}
9+
10+
module "system" {
11+
source = "../../modules/system"
12+
13+
environment = var.environment
14+
project = var.project
15+
export_expiration = var.export_expiration
16+
key_recovery_period = var.key_recovery_period
17+
logging_bucket = var.logging_bucket
18+
vpc_id = var.vpc_id
19+
database_subnets = var.database_subnet_ids
20+
tags = var.tags
21+
}

tofu/config/service/outputs.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
output "export_bucket" {
2+
value = module.system.export_bucket
3+
description = "The name of the S3 bucket for exports."
4+
}
5+
6+
output "queue_url" {
7+
value = module.system.queue_url
8+
description = "The URL of the SQS queue."
9+
}

tofu/config/service/providers.tf

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+
}

tofu/config/service/variables.tf

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
variable "environment" {
2+
type = string
3+
description = "Environment for the deployment."
4+
default = "development"
5+
}
6+
7+
variable "export_expiration" {
8+
type = number
9+
default = 365
10+
description = "Number of days before export files expire."
11+
}
12+
13+
variable "key_recovery_period" {
14+
type = number
15+
default = 30
16+
description = "Recovery period for deleted KMS keys in days. Must be between 7 and 30."
17+
18+
validation {
19+
condition = var.key_recovery_period > 6 && var.key_recovery_period < 31
20+
error_message = "Recovery period must be between 7 and 30."
21+
}
22+
}
23+
24+
variable "logging_bucket" {
25+
type = string
26+
description = "The name of the S3 bucket for logging."
27+
}
28+
29+
variable "program" {
30+
type = string
31+
description = "Program the application belongs to."
32+
default = null
33+
}
34+
35+
variable "project" {
36+
type = string
37+
description = "Project that these resources are supporting."
38+
default = "sqs-senzing"
39+
}
40+
41+
variable "region" {
42+
type = string
43+
description = "AWS region where resources should be deployed."
44+
default = "us-west-1"
45+
}
46+
47+
variable "tags" {
48+
type = map(string)
49+
description = "Tags to apply to all resources."
50+
default = {}
51+
}
52+
53+
variable "vpc_id" {
54+
type = string
55+
description = "ID of the VPC to deploy resources into."
56+
}
57+
58+
variable "database_subnet_ids" {
59+
type = list(string)
60+
description = "The IDs of the subnets to use for the database."
61+
}
62+
63+
variable "container_subnet_ids" {
64+
type = list(string)
65+
description = "The IDs of the subnets to use for container resources."
66+
}

tofu/config/service/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+
}

tofu/modules/system/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module "sqs" {
2323

2424
kms_master_key_id = aws_kms_key.this.id
2525
kms_data_key_reuse_period_seconds = 3600
26-
create_dlq = true
26+
create_dlq = true
2727

2828
tags = var.tags
2929
}

tofu/modules/system/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
variable "database_subnets" {
2+
description = "Subnets to place the database instances in."
3+
type = list(string)
4+
}
5+
16
variable "environment" {
27
type = string
38
description = "Environment for the deployment."
@@ -65,3 +70,8 @@ variable "tags" {
6570
description = "Tags to apply to resources."
6671
default = {}
6772
}
73+
74+
variable "vpc_id" {
75+
description = "The ID of the VPC in which the resources should be deployed."
76+
type = string
77+
}

0 commit comments

Comments
 (0)