Skip to content

Commit 5203cac

Browse files
committed
ECR Repository for Archival Packaging Tool (APT)
Why these changes are being introduced: A new archival packaging tool application is getting built and it will run as a Fargate task, so it needs an ECR repository. How this addresses that need: * Create a new ECR repository along with the associate GHA roles for automation and the Terraform outputs for the GHA workflows for the application repository * Update the pre-commit dependencies * Update the README Side effects of this change: None. Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IN-1221 wip
1 parent 4dc2abd commit 5203cac

File tree

3 files changed

+77
-2
lines changed

3 files changed

+77
-2
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: "v1.97.4"
3+
rev: "v1.98.0"
44
hooks:
55
- id: terraform_fmt
66
args:
@@ -12,7 +12,7 @@ repos:
1212
- id: terraform-docs-go
1313
args: ["markdown", "table", "--config", "./.terraform-docs.yaml", "--recursive", "--output-file", "README.md", "./"]
1414
- repo: https://github.com/bridgecrewio/checkov.git
15-
rev: '3.2.378'
15+
rev: '3.2.395'
1616
hooks:
1717
- id: checkov
1818
language_version: python3.12

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ This is a core infrastructure repository that defines infrastructure related to
9797
* [Alma Webhook Lambdas](https://github.com/MITLibraries/alma-webhook-lambdas)
9898
* [Alma Patron Load](https://github.com/MITLibraries/mitlib-tf-workloads-patronload)
9999
* [Alma Patron Load Application Container](https://github.com/MITLibraries/alma-patronload)
100+
* [Archival Packaging Tool](https://github.com/MITLibraries/mitlib-tf-workloads-apt)
101+
* [Archival Packaging Tool Application Container](https://github.com/MITLibraries/archival-packaging-tool)
100102
* [ASATI](https://github.com/MITLibraries/mitlib-tf-workloads-asati)
101103
* [ASATI Application Container](https://github.com/MITLibraries/asati)
102104
* [Carbon](https://github.com/MITLibraries/mitlib-tf-workloads-carbon)
@@ -153,6 +155,7 @@ This is a core infrastructure repository that defines infrastructure related to
153155
| Name | Source | Version |
154156
|------|--------|---------|
155157
| ecr\_alma\_webhook\_lambdas | ./modules/ecr | n/a |
158+
| ecr\_apt | ./modules/ecr | n/a |
156159
| ecr\_asati | ./modules/ecr | n/a |
157160
| ecr\_bursar | ./modules/ecr | n/a |
158161
| ecr\_carbon | ./modules/ecr | n/a |
@@ -205,6 +208,10 @@ This is a core infrastructure repository that defines infrastructure related to
205208
| alma\_webhook\_lambdas\_makefile | Full contents of the Makefile for the alma-webhook-lambdas repo (allows devs to push to Dev account only) |
206209
| alma\_webhook\_lambdas\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the alma-webhook-lambdas repo |
207210
| alma\_webhook\_lambdas\_stage\_build\_workflow | Full contents of the stage-build.yml for the alma-webhook-lambdas repo |
211+
| apt\_fargate\_dev\_build\_workflow | Full contents of the dev-build.yml for the archival-packaging-tool repo |
212+
| apt\_fargate\_makefile | Full contents of the Makefile for the archival-packaging-tool repo (allows devs to push to Dev account only) |
213+
| apt\_fargate\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the archival-packaging-tool repo |
214+
| apt\_fargate\_stage\_build\_workflow | Full contents of the stage-build.yml for the archival-packaging-tool repo |
208215
| asati\_fargate\_dev\_build\_workflow | Full contents of the dev-build.yml for the asati repo |
209216
| asati\_fargate\_makefile | Full contents of the Makefile for the asati repo (allows devs to push to Dev account only) |
210217
| asati\_fargate\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the asati repo |

apt_ecr.tf

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Archival Packaging Tool (apt) containers
2+
# A standard ECR for an ECS Fargate task
3+
4+
locals {
5+
ecr_apt = "archival-packaging-tool-${var.environment}"
6+
}
7+
8+
module "ecr_apt" {
9+
source = "./modules/ecr"
10+
repo_name = "archival-packaging-tool"
11+
login_policy_arn = aws_iam_policy.login.arn
12+
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
13+
environment = var.environment
14+
tfoutput_ssm_path = var.tfoutput_ssm_path
15+
tags = {
16+
app-repo = "archival-packaging-tool"
17+
}
18+
}
19+
20+
## Outputs to Terraform Cloud for devs ##
21+
22+
## For archival-packaging-tool application repo and ECR repository
23+
# Outputs in dev
24+
output "apt_fargate_dev_build_workflow" {
25+
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
26+
region = var.aws_region
27+
role = module.ecr_apt.gha_role
28+
ecr = module.ecr_apt.repository_name
29+
function = ""
30+
}
31+
)
32+
description = "Full contents of the dev-build.yml for the archival-packaging-tool repo"
33+
}
34+
output "apt_fargate_makefile" {
35+
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
36+
ecr_name = module.ecr_apt.repository_name
37+
ecr_url = module.ecr_apt.repository_url
38+
function = ""
39+
}
40+
)
41+
description = "Full contents of the Makefile for the archival-packaging-tool repo (allows devs to push to Dev account only)"
42+
}
43+
44+
# Outputs in stage
45+
output "apt_fargate_stage_build_workflow" {
46+
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
47+
region = var.aws_region
48+
role = module.ecr_apt.gha_role
49+
ecr = module.ecr_apt.repository_name
50+
function = ""
51+
}
52+
)
53+
description = "Full contents of the stage-build.yml for the archival-packaging-tool repo"
54+
}
55+
56+
# Outputs after promotion to prod
57+
output "apt_fargate_prod_promote_workflow" {
58+
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
59+
region = var.aws_region
60+
role_stage = "${module.ecr_apt.repo_name}-gha-stage"
61+
role_prod = "${module.ecr_apt.repo_name}-gha-prod"
62+
ecr_stage = "${module.ecr_apt.repo_name}-stage"
63+
ecr_prod = "${module.ecr_apt.repo_name}-prod"
64+
function = ""
65+
}
66+
)
67+
description = "Full contents of the prod-promote.yml for the archival-packaging-tool repo"
68+
}

0 commit comments

Comments
 (0)