Skip to content

Commit 7a87e85

Browse files
committed
add asati app container
Why these changes are being introduced: This commit creates the ArchivesSpace AirTable Integration (ASATI) application container infrastructure. The application source code is located in the https://github.com/MITLibraries/asati repository. ASATI is an AWS Fargate application. How this addresses that need: * Add a standard ECR for an ECS w/ Fargate launch type * Update terraform.lock.hcl file * Update the shared workflow for pre-commit configurations * Supress checkov policy warning Side effects of this change: None Relevant ticket(s): https://mitlibraries.atlassian.net/browse/IN-1147 Changes to be committed: modified: .pre-commit-config.yaml modified: .terraform.lock.hcl modified: README.md new file: asati_ecr.tf modified: modules/ecr/.terraform.lock.hcl modified: modules/ecr/main.tf
1 parent bc5f5cf commit 7a87e85

File tree

6 files changed

+76
-2
lines changed

6 files changed

+76
-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.92.1"
3+
rev: "v1.97.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.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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ then replace all the ssm parameter references for `oidc_arn` with `aws_iam_openi
110110
| Name | Source | Version |
111111
|------|--------|---------|
112112
| ecr\_alma\_webhook\_lambdas | ./modules/ecr | n/a |
113+
| ecr\_asati | ./modules/ecr | n/a |
113114
| ecr\_bursar | ./modules/ecr | n/a |
114115
| ecr\_carbon | ./modules/ecr | n/a |
115116
| ecr\_creditcardslips | ./modules/ecr | n/a |
@@ -158,6 +159,10 @@ then replace all the ssm parameter references for `oidc_arn` with `aws_iam_openi
158159
| alma\_webhook\_lambdas\_makefile | Full contents of the Makefile for the alma-webhook-lambdas repo (allows devs to push to Dev account only) |
159160
| alma\_webhook\_lambdas\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the alma-webhook-lambdas repo |
160161
| alma\_webhook\_lambdas\_stage\_build\_workflow | Full contents of the stage-build.yml for the alma-webhook-lambdas repo |
162+
| asati\_fargate\_dev\_build\_workflow | Full contents of the dev-build.yml for the asati repo |
163+
| asati\_fargate\_makefile | Full contents of the Makefile for the asati repo (allows devs to push to Dev account only) |
164+
| asati\_fargate\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the asati repo |
165+
| asati\_fargate\_stage\_build\_workflow | Full contents of the stage-build.yml for the asati repo |
161166
| browsertrix\_dev\_build\_workflow | Full contents of the dev-build.yml for the browsertrix-harvester repo |
162167
| browsertrix\_makefile | Full contents of the Makefile for the browsertrix-harvester repo (allows devs to push to Dev account only) |
163168
| 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 = "docker-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 = "docker-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)