forked from awslabs/amazon-bedrock-agentcore-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodebuild.tf
More file actions
154 lines (126 loc) · 4.07 KB
/
codebuild.tf
File metadata and controls
154 lines (126 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# ============================================================================
# CodeBuild Project - Build and Push Orchestrator Agent Docker Image
# ============================================================================
resource "aws_codebuild_project" "orchestrator_image" {
name = "${var.stack_name}-orchestrator-build"
description = "Build Orchestrator agent Docker image for ${var.stack_name}"
service_role = aws_iam_role.codebuild.arn
build_timeout = 60
artifacts {
type = "NO_ARTIFACTS"
}
environment {
compute_type = "BUILD_GENERAL1_LARGE"
image = "aws/codebuild/amazonlinux2-aarch64-standard:3.0"
type = "ARM_CONTAINER"
privileged_mode = true
image_pull_credentials_type = "CODEBUILD"
environment_variable {
name = "AWS_DEFAULT_REGION"
value = data.aws_region.current.id
}
environment_variable {
name = "AWS_ACCOUNT_ID"
value = data.aws_caller_identity.current.id
}
environment_variable {
name = "IMAGE_REPO_NAME"
value = aws_ecr_repository.orchestrator.name
}
environment_variable {
name = "IMAGE_TAG"
value = var.image_tag
}
environment_variable {
name = "STACK_NAME"
value = var.stack_name
}
environment_variable {
name = "AGENT_NAME"
value = "orchestrator"
}
}
source {
type = "S3"
location = "${aws_s3_bucket.orchestrator_source.id}/${aws_s3_object.orchestrator_source.key}"
buildspec = file("${path.module}/buildspec-orchestrator.yml")
}
logs_config {
cloudwatch_logs {
group_name = "/aws/codebuild/${var.stack_name}-orchestrator-build"
}
}
tags = {
Name = "${var.stack_name}-orchestrator-build"
Module = "CodeBuild"
Agent = "Orchestrator"
}
depends_on = [
aws_iam_role_policy.codebuild
]
}
# ============================================================================
# CodeBuild Project - Build and Push Specialist Agent Docker Image
# ============================================================================
resource "aws_codebuild_project" "specialist_image" {
name = "${var.stack_name}-specialist-build"
description = "Build Specialist agent Docker image for ${var.stack_name}"
service_role = aws_iam_role.codebuild.arn
build_timeout = 60
artifacts {
type = "NO_ARTIFACTS"
}
environment {
compute_type = "BUILD_GENERAL1_LARGE"
image = "aws/codebuild/amazonlinux2-aarch64-standard:3.0"
type = "ARM_CONTAINER"
privileged_mode = true
image_pull_credentials_type = "CODEBUILD"
environment_variable {
name = "AWS_DEFAULT_REGION"
value = data.aws_region.current.id
}
environment_variable {
name = "AWS_ACCOUNT_ID"
value = data.aws_caller_identity.current.id
}
environment_variable {
name = "IMAGE_REPO_NAME"
value = aws_ecr_repository.specialist.name
}
environment_variable {
name = "IMAGE_TAG"
value = var.image_tag
}
environment_variable {
name = "STACK_NAME"
value = var.stack_name
}
environment_variable {
name = "AGENT_NAME"
value = "specialist"
}
}
source {
type = "S3"
location = "${aws_s3_bucket.specialist_source.id}/${aws_s3_object.specialist_source.key}"
buildspec = file("${path.module}/buildspec-specialist.yml")
}
logs_config {
cloudwatch_logs {
group_name = "/aws/codebuild/${var.stack_name}-specialist-build"
}
}
tags = {
Name = "${var.stack_name}-specialist-build"
Module = "CodeBuild"
Agent = "Specialist"
}
depends_on = [
aws_iam_role_policy.codebuild
]
}
# ============================================================================
# Note: Build triggers are defined in main.tf for proper sequencing
# Specialist builds first, then Orchestrator (which depends on Specialist ARN)
# ============================================================================