thinkwork-cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cli.js +251 -47
- package/dist/terraform/examples/greenfield/main.tf +190 -0
- package/dist/terraform/examples/greenfield/terraform.tfvars.example +28 -0
- package/dist/terraform/modules/_internal/workspace-guard/main.tf +29 -0
- package/dist/terraform/modules/app/agentcore-runtime/main.tf +217 -0
- package/dist/terraform/modules/app/appsync-subscriptions/main.tf +122 -0
- package/dist/terraform/modules/app/appsync-subscriptions/outputs.tf +20 -0
- package/dist/terraform/modules/app/appsync-subscriptions/variables.tf +31 -0
- package/dist/terraform/modules/app/crons/main.tf +55 -0
- package/dist/terraform/modules/app/hindsight-memory/README.md +66 -0
- package/dist/terraform/modules/app/hindsight-memory/main.tf +331 -0
- package/dist/terraform/modules/app/job-triggers/main.tf +70 -0
- package/dist/terraform/modules/app/lambda-api/.build/placeholder.zip +0 -0
- package/dist/terraform/modules/app/lambda-api/handlers.tf +311 -0
- package/dist/terraform/modules/app/lambda-api/main.tf +245 -0
- package/dist/terraform/modules/app/lambda-api/outputs.tf +24 -0
- package/dist/terraform/modules/app/lambda-api/variables.tf +153 -0
- package/dist/terraform/modules/app/ses-email/main.tf +51 -0
- package/dist/terraform/modules/app/static-site/main.tf +176 -0
- package/dist/terraform/modules/data/aurora-postgres/README.md +92 -0
- package/dist/terraform/modules/data/aurora-postgres/main.tf +185 -0
- package/dist/terraform/modules/data/aurora-postgres/outputs.tf +30 -0
- package/dist/terraform/modules/data/aurora-postgres/variables.tf +114 -0
- package/dist/terraform/modules/data/bedrock-knowledge-base/main.tf +102 -0
- package/dist/terraform/modules/data/s3-buckets/main.tf +91 -0
- package/dist/terraform/modules/foundation/cognito/main.tf +377 -0
- package/dist/terraform/modules/foundation/cognito/outputs.tf +29 -0
- package/dist/terraform/modules/foundation/cognito/variables.tf +124 -0
- package/dist/terraform/modules/foundation/dns/main.tf +49 -0
- package/dist/terraform/modules/foundation/kms/main.tf +49 -0
- package/dist/terraform/modules/foundation/vpc/main.tf +137 -0
- package/dist/terraform/modules/foundation/vpc/outputs.tf +14 -0
- package/dist/terraform/modules/foundation/vpc/variables.tf +40 -0
- package/dist/terraform/modules/thinkwork/main.tf +212 -0
- package/dist/terraform/modules/thinkwork/outputs.tf +87 -0
- package/dist/terraform/modules/thinkwork/variables.tf +241 -0
- package/dist/terraform/schema.graphql +199 -0
- package/package.json +2 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
output "user_pool_id" {
|
|
2
|
+
description = "Cognito user pool ID (created or existing)"
|
|
3
|
+
value = local.user_pool_id
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
output "user_pool_arn" {
|
|
7
|
+
description = "Cognito user pool ARN (created or existing)"
|
|
8
|
+
value = local.user_pool_arn
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
output "admin_client_id" {
|
|
12
|
+
description = "App client ID for the web admin client (created or existing)"
|
|
13
|
+
value = local.admin_client_id
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
output "mobile_client_id" {
|
|
17
|
+
description = "App client ID for the mobile client (created or existing)"
|
|
18
|
+
value = local.mobile_client_id
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
output "identity_pool_id" {
|
|
22
|
+
description = "Identity pool ID (created or existing)"
|
|
23
|
+
value = local.identity_pool_id
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
output "auth_domain" {
|
|
27
|
+
description = "Cognito hosted UI domain (only available when create_cognito = true)"
|
|
28
|
+
value = local.create ? aws_cognito_user_pool_domain.main[0].domain : null
|
|
29
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
variable "stage" {
|
|
2
|
+
description = "Deployment stage (e.g. dev, prod)"
|
|
3
|
+
type = string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
variable "region" {
|
|
7
|
+
description = "AWS region"
|
|
8
|
+
type = string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
# BYO Cognito
|
|
13
|
+
# ---------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
variable "create_cognito" {
|
|
16
|
+
description = "Whether to create a new Cognito user pool. Set to false to use an existing pool."
|
|
17
|
+
type = bool
|
|
18
|
+
default = true
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
variable "existing_user_pool_id" {
|
|
22
|
+
description = "ID of an existing Cognito user pool (required when create_cognito = false)"
|
|
23
|
+
type = string
|
|
24
|
+
default = null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
variable "existing_user_pool_arn" {
|
|
28
|
+
description = "ARN of an existing Cognito user pool (required when create_cognito = false)"
|
|
29
|
+
type = string
|
|
30
|
+
default = null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
variable "existing_admin_client_id" {
|
|
34
|
+
description = "App client ID for the web admin client (required when create_cognito = false)"
|
|
35
|
+
type = string
|
|
36
|
+
default = null
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
variable "existing_mobile_client_id" {
|
|
40
|
+
description = "App client ID for the mobile client (required when create_cognito = false)"
|
|
41
|
+
type = string
|
|
42
|
+
default = null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
variable "existing_identity_pool_id" {
|
|
46
|
+
description = "ID of an existing identity pool (required when create_cognito = false)"
|
|
47
|
+
type = string
|
|
48
|
+
default = null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# ---------------------------------------------------------------------------
|
|
52
|
+
# User Pool Configuration (only used when create_cognito = true)
|
|
53
|
+
# ---------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
variable "user_pool_name" {
|
|
56
|
+
description = "Override the user pool name (defaults to thinkwork-<stage>-user-pool)"
|
|
57
|
+
type = string
|
|
58
|
+
default = ""
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
variable "identity_pool_name" {
|
|
62
|
+
description = "Override the identity pool name (defaults to thinkwork-<stage>-identity-pool)"
|
|
63
|
+
type = string
|
|
64
|
+
default = ""
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
variable "google_oauth_client_id" {
|
|
68
|
+
description = "Google OAuth client ID for social login"
|
|
69
|
+
type = string
|
|
70
|
+
default = ""
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
variable "google_oauth_client_secret" {
|
|
74
|
+
description = "Google OAuth client secret for social login"
|
|
75
|
+
type = string
|
|
76
|
+
sensitive = true
|
|
77
|
+
default = ""
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
variable "pre_signup_lambda_zip" {
|
|
81
|
+
description = "Path to the pre-signup Lambda zip file"
|
|
82
|
+
type = string
|
|
83
|
+
default = ""
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# ---------------------------------------------------------------------------
|
|
87
|
+
# Callback URLs (configurable per deployment)
|
|
88
|
+
# ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
variable "admin_callback_urls" {
|
|
91
|
+
description = "OAuth callback URLs for the web admin client"
|
|
92
|
+
type = list(string)
|
|
93
|
+
default = [
|
|
94
|
+
"http://localhost:5174",
|
|
95
|
+
"http://localhost:5174/auth/callback",
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
variable "admin_logout_urls" {
|
|
100
|
+
description = "OAuth logout URLs for the web admin client"
|
|
101
|
+
type = list(string)
|
|
102
|
+
default = [
|
|
103
|
+
"http://localhost:5174",
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
variable "mobile_callback_urls" {
|
|
108
|
+
description = "OAuth callback URLs for the mobile client"
|
|
109
|
+
type = list(string)
|
|
110
|
+
default = [
|
|
111
|
+
"exp://localhost:8081",
|
|
112
|
+
"thinkwork://",
|
|
113
|
+
"thinkwork://auth/callback",
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
variable "mobile_logout_urls" {
|
|
118
|
+
description = "OAuth logout URLs for the mobile client"
|
|
119
|
+
type = list(string)
|
|
120
|
+
default = [
|
|
121
|
+
"exp://localhost:8081",
|
|
122
|
+
"thinkwork://",
|
|
123
|
+
]
|
|
124
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
################################################################################
|
|
2
|
+
# DNS — Foundation Module
|
|
3
|
+
#
|
|
4
|
+
# Manages a Route53 hosted zone, or accepts an existing zone ID.
|
|
5
|
+
# Other modules reference the zone for custom domains (AppSync, API Gateway,
|
|
6
|
+
# CloudFront, docs site).
|
|
7
|
+
################################################################################
|
|
8
|
+
|
|
9
|
+
variable "stage" {
|
|
10
|
+
description = "Deployment stage"
|
|
11
|
+
type = string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
variable "create_zone" {
|
|
15
|
+
description = "Whether to create a new Route53 hosted zone. Set to false to use an existing zone."
|
|
16
|
+
type = bool
|
|
17
|
+
default = false
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
variable "domain_name" {
|
|
21
|
+
description = "Domain name for the hosted zone (e.g. thinkwork.ai)"
|
|
22
|
+
type = string
|
|
23
|
+
default = ""
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
variable "existing_zone_id" {
|
|
27
|
+
description = "ID of an existing Route53 hosted zone (required when create_zone = false)"
|
|
28
|
+
type = string
|
|
29
|
+
default = null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
resource "aws_route53_zone" "main" {
|
|
33
|
+
count = var.create_zone ? 1 : 0
|
|
34
|
+
name = var.domain_name
|
|
35
|
+
|
|
36
|
+
tags = {
|
|
37
|
+
Name = "thinkwork-${var.stage}-zone"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
output "zone_id" {
|
|
42
|
+
description = "Route53 hosted zone ID (created or existing)"
|
|
43
|
+
value = var.create_zone ? aws_route53_zone.main[0].zone_id : var.existing_zone_id
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
output "name_servers" {
|
|
47
|
+
description = "Name servers for the zone (only available when create_zone = true)"
|
|
48
|
+
value = var.create_zone ? aws_route53_zone.main[0].name_servers : []
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
################################################################################
|
|
2
|
+
# KMS — Foundation Module
|
|
3
|
+
#
|
|
4
|
+
# Creates KMS keys for encryption at rest, or accepts existing key ARNs.
|
|
5
|
+
# v1: single key for general-purpose encryption (Aurora, S3, SSM, logs).
|
|
6
|
+
################################################################################
|
|
7
|
+
|
|
8
|
+
variable "stage" {
|
|
9
|
+
description = "Deployment stage"
|
|
10
|
+
type = string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
variable "create_kms_key" {
|
|
14
|
+
description = "Whether to create a new KMS key. Set to false to use an existing key."
|
|
15
|
+
type = bool
|
|
16
|
+
default = true
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
variable "existing_kms_key_arn" {
|
|
20
|
+
description = "ARN of an existing KMS key (required when create_kms_key = false)"
|
|
21
|
+
type = string
|
|
22
|
+
default = null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
resource "aws_kms_key" "main" {
|
|
26
|
+
count = var.create_kms_key ? 1 : 0
|
|
27
|
+
description = "Thinkwork ${var.stage} general-purpose encryption key"
|
|
28
|
+
enable_key_rotation = true
|
|
29
|
+
|
|
30
|
+
tags = {
|
|
31
|
+
Name = "thinkwork-${var.stage}-main"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
resource "aws_kms_alias" "main" {
|
|
36
|
+
count = var.create_kms_key ? 1 : 0
|
|
37
|
+
name = "alias/thinkwork-${var.stage}"
|
|
38
|
+
target_key_id = aws_kms_key.main[0].key_id
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
output "key_arn" {
|
|
42
|
+
description = "KMS key ARN (created or existing)"
|
|
43
|
+
value = var.create_kms_key ? aws_kms_key.main[0].arn : var.existing_kms_key_arn
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
output "key_id" {
|
|
47
|
+
description = "KMS key ID (only available when create_kms_key = true)"
|
|
48
|
+
value = var.create_kms_key ? aws_kms_key.main[0].key_id : null
|
|
49
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
################################################################################
|
|
2
|
+
# VPC — Foundation Module
|
|
3
|
+
#
|
|
4
|
+
# Creates a VPC with public and private subnets across two AZs,
|
|
5
|
+
# or accepts an existing VPC via BYO variables.
|
|
6
|
+
################################################################################
|
|
7
|
+
|
|
8
|
+
locals {
|
|
9
|
+
vpc_id = var.create_vpc ? aws_vpc.main[0].id : var.existing_vpc_id
|
|
10
|
+
public_subnet_ids = var.create_vpc ? [aws_subnet.public[0].id, aws_subnet.public[1].id] : var.existing_public_subnet_ids
|
|
11
|
+
private_subnet_ids = var.create_vpc ? [aws_subnet.private[0].id, aws_subnet.private[1].id] : var.existing_private_subnet_ids
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
################################################################################
|
|
15
|
+
# VPC
|
|
16
|
+
################################################################################
|
|
17
|
+
|
|
18
|
+
resource "aws_vpc" "main" {
|
|
19
|
+
count = var.create_vpc ? 1 : 0
|
|
20
|
+
|
|
21
|
+
cidr_block = var.cidr_block
|
|
22
|
+
enable_dns_support = true
|
|
23
|
+
enable_dns_hostnames = true
|
|
24
|
+
|
|
25
|
+
tags = {
|
|
26
|
+
Name = "thinkwork-${var.stage}-vpc"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
################################################################################
|
|
31
|
+
# Internet Gateway
|
|
32
|
+
################################################################################
|
|
33
|
+
|
|
34
|
+
resource "aws_internet_gateway" "main" {
|
|
35
|
+
count = var.create_vpc ? 1 : 0
|
|
36
|
+
|
|
37
|
+
vpc_id = aws_vpc.main[0].id
|
|
38
|
+
|
|
39
|
+
tags = {
|
|
40
|
+
Name = "thinkwork-${var.stage}-igw"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
################################################################################
|
|
45
|
+
# Subnets
|
|
46
|
+
################################################################################
|
|
47
|
+
|
|
48
|
+
resource "aws_subnet" "public" {
|
|
49
|
+
count = var.create_vpc ? length(var.availability_zones) : 0
|
|
50
|
+
|
|
51
|
+
vpc_id = aws_vpc.main[0].id
|
|
52
|
+
cidr_block = cidrsubnet(var.cidr_block, 6, count.index)
|
|
53
|
+
availability_zone = var.availability_zones[count.index]
|
|
54
|
+
map_public_ip_on_launch = true
|
|
55
|
+
|
|
56
|
+
tags = {
|
|
57
|
+
Name = "thinkwork-${var.stage}-pub-${var.availability_zones[count.index]}"
|
|
58
|
+
Tier = "public"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
resource "aws_subnet" "private" {
|
|
63
|
+
count = var.create_vpc ? length(var.availability_zones) : 0
|
|
64
|
+
|
|
65
|
+
vpc_id = aws_vpc.main[0].id
|
|
66
|
+
cidr_block = cidrsubnet(var.cidr_block, 6, count.index + length(var.availability_zones))
|
|
67
|
+
availability_zone = var.availability_zones[count.index]
|
|
68
|
+
|
|
69
|
+
tags = {
|
|
70
|
+
Name = "thinkwork-${var.stage}-priv-${var.availability_zones[count.index]}"
|
|
71
|
+
Tier = "private"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
################################################################################
|
|
76
|
+
# Route Tables — Public
|
|
77
|
+
################################################################################
|
|
78
|
+
|
|
79
|
+
resource "aws_route_table" "public" {
|
|
80
|
+
count = var.create_vpc ? length(var.availability_zones) : 0
|
|
81
|
+
|
|
82
|
+
vpc_id = aws_vpc.main[0].id
|
|
83
|
+
|
|
84
|
+
tags = {
|
|
85
|
+
Name = "thinkwork-${var.stage}-pub-rt-${var.availability_zones[count.index]}"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
resource "aws_route" "public_igw" {
|
|
90
|
+
count = var.create_vpc ? length(var.availability_zones) : 0
|
|
91
|
+
|
|
92
|
+
route_table_id = aws_route_table.public[count.index].id
|
|
93
|
+
destination_cidr_block = "0.0.0.0/0"
|
|
94
|
+
gateway_id = aws_internet_gateway.main[0].id
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
resource "aws_route_table_association" "public" {
|
|
98
|
+
count = var.create_vpc ? length(var.availability_zones) : 0
|
|
99
|
+
|
|
100
|
+
subnet_id = aws_subnet.public[count.index].id
|
|
101
|
+
route_table_id = aws_route_table.public[count.index].id
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
################################################################################
|
|
105
|
+
# Route Tables — Private
|
|
106
|
+
################################################################################
|
|
107
|
+
|
|
108
|
+
resource "aws_route_table" "private" {
|
|
109
|
+
count = var.create_vpc ? length(var.availability_zones) : 0
|
|
110
|
+
|
|
111
|
+
vpc_id = aws_vpc.main[0].id
|
|
112
|
+
|
|
113
|
+
tags = {
|
|
114
|
+
Name = "thinkwork-${var.stage}-priv-rt-${var.availability_zones[count.index]}"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
resource "aws_route_table_association" "private" {
|
|
119
|
+
count = var.create_vpc ? length(var.availability_zones) : 0
|
|
120
|
+
|
|
121
|
+
subnet_id = aws_subnet.private[count.index].id
|
|
122
|
+
route_table_id = aws_route_table.private[count.index].id
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
################################################################################
|
|
126
|
+
# Default Route Table
|
|
127
|
+
################################################################################
|
|
128
|
+
|
|
129
|
+
resource "aws_default_route_table" "main" {
|
|
130
|
+
count = var.create_vpc ? 1 : 0
|
|
131
|
+
|
|
132
|
+
default_route_table_id = aws_vpc.main[0].default_route_table_id
|
|
133
|
+
|
|
134
|
+
tags = {
|
|
135
|
+
Name = "thinkwork-${var.stage}-main-rt"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
output "vpc_id" {
|
|
2
|
+
description = "ID of the VPC (created or existing)"
|
|
3
|
+
value = local.vpc_id
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
output "public_subnet_ids" {
|
|
7
|
+
description = "IDs of the public subnets (created or existing)"
|
|
8
|
+
value = local.public_subnet_ids
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
output "private_subnet_ids" {
|
|
12
|
+
description = "IDs of the private subnets (created or existing)"
|
|
13
|
+
value = local.private_subnet_ids
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
variable "stage" {
|
|
2
|
+
description = "Deployment stage (e.g. dev, prod)"
|
|
3
|
+
type = string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
variable "create_vpc" {
|
|
7
|
+
description = "Whether to create a new VPC. Set to false and provide existing_vpc_id to use an existing VPC."
|
|
8
|
+
type = bool
|
|
9
|
+
default = true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
variable "existing_vpc_id" {
|
|
13
|
+
description = "ID of an existing VPC to use (required when create_vpc = false)"
|
|
14
|
+
type = string
|
|
15
|
+
default = null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
variable "existing_public_subnet_ids" {
|
|
19
|
+
description = "IDs of existing public subnets (required when create_vpc = false)"
|
|
20
|
+
type = list(string)
|
|
21
|
+
default = []
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
variable "existing_private_subnet_ids" {
|
|
25
|
+
description = "IDs of existing private subnets (required when create_vpc = false)"
|
|
26
|
+
type = list(string)
|
|
27
|
+
default = []
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
variable "cidr_block" {
|
|
31
|
+
description = "CIDR block for the VPC (only used when create_vpc = true)"
|
|
32
|
+
type = string
|
|
33
|
+
default = "10.0.0.0/16"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
variable "availability_zones" {
|
|
37
|
+
description = "Availability zones for subnets (only used when create_vpc = true)"
|
|
38
|
+
type = list(string)
|
|
39
|
+
default = ["us-east-1a", "us-east-1b"]
|
|
40
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
################################################################################
|
|
2
|
+
# Thinkwork Composite Root
|
|
3
|
+
#
|
|
4
|
+
# Wires the three tiers (foundation → data → app) together with sensible
|
|
5
|
+
# defaults. This is the module published to the Terraform Registry as
|
|
6
|
+
# `thinkwork-ai/thinkwork/aws`.
|
|
7
|
+
#
|
|
8
|
+
# For advanced composition, use the sub-modules directly:
|
|
9
|
+
# source = "thinkwork-ai/thinkwork/aws//modules/foundation/vpc"
|
|
10
|
+
################################################################################
|
|
11
|
+
|
|
12
|
+
locals {
|
|
13
|
+
bucket_name = var.bucket_name != "" ? var.bucket_name : "thinkwork-${var.stage}-storage"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
################################################################################
|
|
17
|
+
# Workspace Guard
|
|
18
|
+
################################################################################
|
|
19
|
+
|
|
20
|
+
module "workspace_guard" {
|
|
21
|
+
source = "../_internal/workspace-guard"
|
|
22
|
+
stage = var.stage
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
################################################################################
|
|
26
|
+
# Foundation Tier
|
|
27
|
+
################################################################################
|
|
28
|
+
|
|
29
|
+
module "vpc" {
|
|
30
|
+
source = "../foundation/vpc"
|
|
31
|
+
|
|
32
|
+
stage = var.stage
|
|
33
|
+
create_vpc = var.create_vpc
|
|
34
|
+
existing_vpc_id = var.existing_vpc_id
|
|
35
|
+
existing_public_subnet_ids = var.existing_public_subnet_ids
|
|
36
|
+
existing_private_subnet_ids = var.existing_private_subnet_ids
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module "kms" {
|
|
40
|
+
source = "../foundation/kms"
|
|
41
|
+
stage = var.stage
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module "cognito" {
|
|
45
|
+
source = "../foundation/cognito"
|
|
46
|
+
|
|
47
|
+
stage = var.stage
|
|
48
|
+
region = var.region
|
|
49
|
+
|
|
50
|
+
create_cognito = var.create_cognito
|
|
51
|
+
existing_user_pool_id = var.existing_user_pool_id
|
|
52
|
+
existing_user_pool_arn = var.existing_user_pool_arn
|
|
53
|
+
existing_admin_client_id = var.existing_admin_client_id
|
|
54
|
+
existing_mobile_client_id = var.existing_mobile_client_id
|
|
55
|
+
existing_identity_pool_id = var.existing_identity_pool_id
|
|
56
|
+
|
|
57
|
+
google_oauth_client_id = var.google_oauth_client_id
|
|
58
|
+
google_oauth_client_secret = var.google_oauth_client_secret
|
|
59
|
+
pre_signup_lambda_zip = var.pre_signup_lambda_zip
|
|
60
|
+
|
|
61
|
+
admin_callback_urls = var.admin_callback_urls
|
|
62
|
+
admin_logout_urls = var.admin_logout_urls
|
|
63
|
+
mobile_callback_urls = var.mobile_callback_urls
|
|
64
|
+
mobile_logout_urls = var.mobile_logout_urls
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module "dns" {
|
|
68
|
+
source = "../foundation/dns"
|
|
69
|
+
stage = var.stage
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
################################################################################
|
|
73
|
+
# Data Tier
|
|
74
|
+
################################################################################
|
|
75
|
+
|
|
76
|
+
module "s3" {
|
|
77
|
+
source = "../data/s3-buckets"
|
|
78
|
+
|
|
79
|
+
stage = var.stage
|
|
80
|
+
account_id = var.account_id
|
|
81
|
+
bucket_name = local.bucket_name
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module "database" {
|
|
85
|
+
source = "../data/aurora-postgres"
|
|
86
|
+
|
|
87
|
+
stage = var.stage
|
|
88
|
+
|
|
89
|
+
create_database = var.create_database
|
|
90
|
+
existing_db_cluster_arn = var.existing_db_cluster_arn
|
|
91
|
+
existing_db_secret_arn = var.existing_db_secret_arn
|
|
92
|
+
existing_db_endpoint = var.existing_db_endpoint
|
|
93
|
+
existing_db_security_group_id = var.existing_db_security_group_id
|
|
94
|
+
|
|
95
|
+
vpc_id = module.vpc.vpc_id
|
|
96
|
+
subnet_ids = module.vpc.public_subnet_ids
|
|
97
|
+
db_password = var.db_password
|
|
98
|
+
|
|
99
|
+
database_name = var.database_name
|
|
100
|
+
database_engine = var.database_engine
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
module "bedrock_kb" {
|
|
104
|
+
source = "../data/bedrock-knowledge-base"
|
|
105
|
+
|
|
106
|
+
stage = var.stage
|
|
107
|
+
account_id = var.account_id
|
|
108
|
+
region = var.region
|
|
109
|
+
bucket_name = module.s3.bucket_name
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
################################################################################
|
|
113
|
+
# App Tier
|
|
114
|
+
################################################################################
|
|
115
|
+
|
|
116
|
+
# Subscription-only schema for AppSync — typed event payloads (from schema:build)
|
|
117
|
+
locals {
|
|
118
|
+
subscription_schema = file("${path.module}/../../schema.graphql")
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
module "appsync" {
|
|
122
|
+
source = "../app/appsync-subscriptions"
|
|
123
|
+
|
|
124
|
+
stage = var.stage
|
|
125
|
+
region = var.region
|
|
126
|
+
user_pool_id = module.cognito.user_pool_id
|
|
127
|
+
subscription_schema = local.subscription_schema
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module "api" {
|
|
131
|
+
source = "../app/lambda-api"
|
|
132
|
+
|
|
133
|
+
stage = var.stage
|
|
134
|
+
account_id = var.account_id
|
|
135
|
+
region = var.region
|
|
136
|
+
|
|
137
|
+
lambda_artifact_bucket = var.lambda_artifact_bucket
|
|
138
|
+
lambda_artifact_prefix = var.lambda_artifact_prefix
|
|
139
|
+
|
|
140
|
+
db_cluster_arn = module.database.db_cluster_arn
|
|
141
|
+
db_cluster_endpoint = module.database.cluster_endpoint
|
|
142
|
+
graphql_db_secret_arn = module.database.graphql_db_secret_arn
|
|
143
|
+
database_name = var.database_name
|
|
144
|
+
|
|
145
|
+
bucket_name = module.s3.bucket_name
|
|
146
|
+
bucket_arn = module.s3.bucket_arn
|
|
147
|
+
|
|
148
|
+
user_pool_id = module.cognito.user_pool_id
|
|
149
|
+
user_pool_arn = module.cognito.user_pool_arn
|
|
150
|
+
admin_client_id = module.cognito.admin_client_id
|
|
151
|
+
mobile_client_id = module.cognito.mobile_client_id
|
|
152
|
+
|
|
153
|
+
appsync_api_url = module.appsync.graphql_api_url
|
|
154
|
+
appsync_api_key = module.appsync.graphql_api_key
|
|
155
|
+
|
|
156
|
+
kb_service_role_arn = module.bedrock_kb.kb_service_role_arn
|
|
157
|
+
|
|
158
|
+
lambda_zips_dir = var.lambda_zips_dir
|
|
159
|
+
api_auth_secret = var.api_auth_secret
|
|
160
|
+
db_password = var.db_password
|
|
161
|
+
agentcore_invoke_url = module.agentcore.agentcore_invoke_url
|
|
162
|
+
agentcore_function_name = module.agentcore.agentcore_function_name
|
|
163
|
+
hindsight_endpoint = var.memory_engine == "hindsight" ? module.hindsight[0].hindsight_endpoint : ""
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
module "agentcore" {
|
|
167
|
+
source = "../app/agentcore-runtime"
|
|
168
|
+
|
|
169
|
+
stage = var.stage
|
|
170
|
+
account_id = var.account_id
|
|
171
|
+
region = var.region
|
|
172
|
+
bucket_name = module.s3.bucket_name
|
|
173
|
+
|
|
174
|
+
memory_engine = var.memory_engine
|
|
175
|
+
hindsight_endpoint = var.memory_engine == "hindsight" ? module.hindsight[0].hindsight_endpoint : ""
|
|
176
|
+
agentcore_memory_id = var.agentcore_memory_id
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
module "crons" {
|
|
180
|
+
source = "../app/crons"
|
|
181
|
+
|
|
182
|
+
stage = var.stage
|
|
183
|
+
account_id = var.account_id
|
|
184
|
+
region = var.region
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
module "job_triggers" {
|
|
188
|
+
source = "../app/job-triggers"
|
|
189
|
+
|
|
190
|
+
stage = var.stage
|
|
191
|
+
account_id = var.account_id
|
|
192
|
+
region = var.region
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
module "hindsight" {
|
|
196
|
+
count = var.memory_engine == "hindsight" ? 1 : 0
|
|
197
|
+
source = "../app/hindsight-memory"
|
|
198
|
+
|
|
199
|
+
stage = var.stage
|
|
200
|
+
vpc_id = module.vpc.vpc_id
|
|
201
|
+
subnet_ids = module.vpc.public_subnet_ids
|
|
202
|
+
db_security_group_id = module.database.db_security_group_id
|
|
203
|
+
database_url = module.database.database_url
|
|
204
|
+
image_tag = var.hindsight_image_tag
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
module "ses" {
|
|
208
|
+
source = "../app/ses-email"
|
|
209
|
+
|
|
210
|
+
stage = var.stage
|
|
211
|
+
account_id = var.account_id
|
|
212
|
+
}
|