Skip to content

Commit 85c2bfd

Browse files
authored
Merge pull request #49 from MITLibraries/dev
Add ECR Repository for ArchivesSpace to Air Table Integration (ASATI) App Container
2 parents 08c55c1 + 03fb383 commit 85c2bfd

File tree

7 files changed

+135
-3
lines changed

7 files changed

+135
-3
lines changed

.github/CODEOWNERS

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# CODEOWNERS file (from GitHub template at
2+
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners)
3+
# Each line is a file pattern followed by one or more owners.
4+
5+
################################################################################
6+
# These owners will be the default owners for everything in the repo. Unless a
7+
# later match takes precedence, @cabutlermit will be requested for review when
8+
# someone opens a pull request.This is commented out in favor of using a team
9+
# as the default (see below). It is left here as a comment to indicate the
10+
# primary expert for this code.
11+
# * @cabutlermit
12+
13+
# Teams can be specified as code owners as well. Teams should be identified in
14+
# the format @org/team-name. Teams must have explicit write access to the
15+
# repository.
16+
* @mitlibraries/infraeng-terraform-reviewers
17+
18+
# We set the senior engineer in the team as the owner of the CODEOWNERS file as
19+
# a layer of protection for unauthorized changes.
20+
/.github/CODEOWNERS @cabutlermit

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: "v1.92.1"
3+
rev: "v1.97.0"
44
hooks:
55
- id: terraform_fmt
66
args:
77
- --args=-recursive
88
- id: terraform_validate
99
- repo: https://github.com/terraform-docs/terraform-docs
10-
rev: "v0.18.0"
10+
rev: "v0.19.0"
1111
hooks:
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.219'
15+
rev: '3.2.353'
1616
hooks:
1717
- id: checkov
1818
language_version: python3.11

.terraform.lock.hcl

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

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,44 @@ then replace all the ssm parameter references for `oidc_arn` with `aws_iam_openi
8989
* [github-actions-push-to-aws-ecr-without-credentials-oidc](https://blog.tedivm.com/guides/2021/10/github-actions-push-to-aws-ecr-without-credentials-oidc/)
9090
* [about-security-hardening-with-openid-connect](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#example-subject-claims)
9191

92+
93+
## Related Assets
94+
95+
This is a core infrastructure repository that defines infrastructure related to ECS, ECR, and Fargate deployments. The following application infrastructure repositories depend on this repository:
96+
97+
* [Alma Hook](https://github.com/MITLibraries/mitlib-tf-workloads-almahook)
98+
* [Alma Integrations](https://github.com/MITLibraries/mitlib-tf-workloads-patronload)
99+
* [Alma Patron Load Application Container](https://github.com/MITLibraries/alma-patronload)
100+
* [ASATI](https://github.com/MITLibraries/mitlib-tf-workloads-asati)
101+
* [ASATI Application Contaier](https://github.com/MITLibraries/asati)
102+
* [Carbon](https://github.com/MITLibraries/mitlib-tf-workloads-carbon)
103+
* [DSS](https://github.com/MITLibraries/mitlib-tf-workloads-dss)
104+
* [DSpace Submission Service Application Container](https://github.com/MITLibraries/dspace-submission-service)
105+
* [ETD](https://github.com/MITLibraries/mitlib-tf-workloads-etd)
106+
* [HRQB](https://github.com/MITLibraries/mitlib-tf-workloads-hrqb-loader)
107+
* [HRQB Client](https://github.com/MITLibraries/hrqb-client)
108+
* [Matomo](https://github.com/MITLibraries/mitlib-tf-workloads-matomo)
109+
* [Matomo Application Container](https://github.com/MITLibraries/docker-matomo)
110+
* [PPOD](https://github.com/MITLibraries/mitlib-tf-workloads-ppod)
111+
* [PPOD Application Container](https://github.com/MITLibraries/ppod)
112+
* [Timdex](https://github.com/MITLibraries/mitlib-tf-workloads-timdex-infrastructure)
113+
* [Timdex Application Container](https://github.com/MITLibraries/timdex)
114+
* [Timdex Dataset API](https://github.com/MITLibraries/timdex-dataset-api)
115+
* [Timdex Index Manager](https://github.com/MITLibraries/timdex-index-manager)
116+
* [Timdex Pipeline Lambdas](https://github.com/MITLibraries/timdex-pipeline-lambdas)
117+
* [Timdex UI](https://github.com/MITLibraries/timdex-ui)
118+
* [Timdex Simulator](https://github.com/MITLibraries/timdex-simulator)
119+
* [WCD2Reshare](https://github.com/MITLibraries/mitlib-tf-workloads-wcd2reshare)
120+
* [WCD2Reshare Appliation Container](https://github.com/MITLibraries/wcd2reshare)
121+
* [Wiley](https://github.com/MITLibraries/mitlib-tf-workloads-wiley)
122+
* [Wiley Deposits Application Container](https://github.com/MITLibraries/mitlib-tf-workloads-wiley)
123+
124+
## Maintainers
125+
126+
* Owner: See [CODEOWNERS](./.github/CODEOWNERS)
127+
* Team: See [CODEOWNERS](./.github/CODEOWNERS)
128+
* Last Maintenance: 2025-01
129+
92130
## TF markdown is automatically inserted at the bottom of this file, nothing should be written beyond this point
93131

94132
<!-- BEGIN_TF_DOCS -->
@@ -110,6 +148,7 @@ then replace all the ssm parameter references for `oidc_arn` with `aws_iam_openi
110148
| Name | Source | Version |
111149
|------|--------|---------|
112150
| ecr\_alma\_webhook\_lambdas | ./modules/ecr | n/a |
151+
| ecr\_asati | ./modules/ecr | n/a |
113152
| ecr\_bursar | ./modules/ecr | n/a |
114153
| ecr\_carbon | ./modules/ecr | n/a |
115154
| ecr\_creditcardslips | ./modules/ecr | n/a |
@@ -158,6 +197,10 @@ then replace all the ssm parameter references for `oidc_arn` with `aws_iam_openi
158197
| alma\_webhook\_lambdas\_makefile | Full contents of the Makefile for the alma-webhook-lambdas repo (allows devs to push to Dev account only) |
159198
| alma\_webhook\_lambdas\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the alma-webhook-lambdas repo |
160199
| alma\_webhook\_lambdas\_stage\_build\_workflow | Full contents of the stage-build.yml for the alma-webhook-lambdas repo |
200+
| asati\_fargate\_dev\_build\_workflow | Full contents of the dev-build.yml for the asati repo |
201+
| asati\_fargate\_makefile | Full contents of the Makefile for the asati repo (allows devs to push to Dev account only) |
202+
| asati\_fargate\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the asati repo |
203+
| asati\_fargate\_stage\_build\_workflow | Full contents of the stage-build.yml for the asati repo |
161204
| browsertrix\_dev\_build\_workflow | Full contents of the dev-build.yml for the browsertrix-harvester repo |
162205
| browsertrix\_makefile | Full contents of the Makefile for the browsertrix-harvester repo (allows devs to push to Dev account only) |
163206
| browsertrix\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the browsertrix-harvester repo |

asati_ecr.tf

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

modules/ecr/.terraform.lock.hcl

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

modules/ecr/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ resource "aws_ecr_lifecycle_policy" "this" {
3838
### Read-write permissions ECR repository
3939
data "aws_iam_policy_document" "rw_this" {
4040
#checkov:skip=CKV_AWS_111:This policy needs unconstrained CreateRepository privileges
41+
#checkov:skip=CKV_AWS_356:This policy should allow "*" as a resource for restrictable actions
4142
statement {
4243
actions = [
4344
"ecr:CreateRepository",

0 commit comments

Comments
 (0)