Skip to content

Commit 2bae135

Browse files
authored
Merge pull request #53 from MITLibraries/dev
Dev-to-Stage: Create ECR for s3-bagit-validator
2 parents 01c5895 + 9d911bd commit 2bae135

File tree

4 files changed

+99
-28
lines changed

4 files changed

+99
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ override.tf.json
2828
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
2929
*tfplan*
3030
.DS_Store
31+
.tool-versions

README.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,33 +95,36 @@ then replace all the ssm parameter references for `oidc_arn` with `aws_iam_openi
9595
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:
9696

9797
* [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)
98+
* [Alma Webhook Lambdas](https://github.com/MITLibraries/alma-webhook-lambdas)
99+
* [Alma Patron Load](https://github.com/MITLibraries/mitlib-tf-workloads-patronload)
100+
* [Alma Patron Load Application Container](https://github.com/MITLibraries/alma-patronload)
100101
* [ASATI](https://github.com/MITLibraries/mitlib-tf-workloads-asati)
101-
* [ASATI Application Container](https://github.com/MITLibraries/asati)
102+
* [ASATI Application Container](https://github.com/MITLibraries/asati)
102103
* [Carbon](https://github.com/MITLibraries/mitlib-tf-workloads-carbon)
103104
* [DSC](https://github.com/MITLibraries/mitlib-tf-workloads-dsc)
104-
* [DSC Application Container](https://github.com/MITLibraries/dspace-submission-composer)
105+
* [DSC Application Container](https://github.com/MITLibraries/dspace-submission-composer)
105106
* [DSS](https://github.com/MITLibraries/mitlib-tf-workloads-dss)
106-
* [DSpace Submission Service Application Container](https://github.com/MITLibraries/dspace-submission-service)
107-
* [ETD](https://github.com/MITLibraries/mitlib-tf-workloads-etd)
107+
* [DSpace Submission Service Application Container](https://github.com/MITLibraries/dspace-submission-service)
108+
* [ETD](https://github.com/MITLibraries/mitlib-tf-workloads-etd)
108109
* [HRQB](https://github.com/MITLibraries/mitlib-tf-workloads-hrqb-loader)
109-
* [HRQB Client](https://github.com/MITLibraries/hrqb-client)
110+
* [HRQB Client](https://github.com/MITLibraries/hrqb-client)
110111
* [Matomo](https://github.com/MITLibraries/mitlib-tf-workloads-matomo)
111-
* [Matomo Application Container](https://github.com/MITLibraries/docker-matomo)
112+
* [Matomo Application Container](https://github.com/MITLibraries/docker-matomo)
112113
* [PPOD](https://github.com/MITLibraries/mitlib-tf-workloads-ppod)
113-
* [PPOD Application Container](https://github.com/MITLibraries/ppod)
114-
* [Timdex](https://github.com/MITLibraries/mitlib-tf-workloads-timdex-infrastructure)
115-
* [Timdex Application Container](https://github.com/MITLibraries/timdex)
116-
* [Timdex Dataset API](https://github.com/MITLibraries/timdex-dataset-api)
117-
* [Timdex Index Manager](https://github.com/MITLibraries/timdex-index-manager)
118-
* [Timdex Pipeline Lambdas](https://github.com/MITLibraries/timdex-pipeline-lambdas)
119-
* [Timdex UI](https://github.com/MITLibraries/timdex-ui)
120-
* [Timdex Simulator](https://github.com/MITLibraries/timdex-simulator)
114+
* [PPOD Application Container](https://github.com/MITLibraries/ppod)
115+
* [CDPS](https://github.com/MITLibraries/mitlib-tf-workloads-cdps-storage)
116+
* [S3 BagIt Validator](https://github.com/MITLibraries/s3-bagit-validator)
117+
* [TIMDEX](https://github.com/MITLibraries/mitlib-tf-workloads-timdex-infrastructure)
118+
* [TIMDEX Application Container](https://github.com/MITLibraries/timdex)
119+
* [TIMDEX Dataset API](https://github.com/MITLibraries/timdex-dataset-api)
120+
* [TIMDEX Index Manager](https://github.com/MITLibraries/timdex-index-manager)
121+
* [TIMDEX Pipeline Lambdas](https://github.com/MITLibraries/timdex-pipeline-lambdas)
122+
* [TIMDEX UI](https://github.com/MITLibraries/timdex-ui)
123+
* [TIMDEX Simulator](https://github.com/MITLibraries/timdex-simulator)
121124
* [WCD2Reshare](https://github.com/MITLibraries/mitlib-tf-workloads-wcd2reshare)
122-
* [WCD2Reshare Appliation Container](https://github.com/MITLibraries/wcd2reshare)
123-
* [Wiley](https://github.com/MITLibraries/mitlib-tf-workloads-wiley)
124-
* [Wiley Deposits Application Container](https://github.com/MITLibraries/mitlib-tf-workloads-wiley)
125+
* [WCD2Reshare Application Container](https://github.com/MITLibraries/wcd2reshare)
126+
* **DEPRECATED**: [Wiley](https://github.com/MITLibraries/mitlib-tf-workloads-wiley)
127+
* **DEPRECATED**: [Wiley Deposits Application Container](https://github.com/MITLibraries/mitlib-tf-workloads-wiley)
125128

126129
## Maintainers
127130

@@ -153,6 +156,7 @@ This is a core infrastructure repository that defines infrastructure related to
153156
| ecr\_asati | ./modules/ecr | n/a |
154157
| ecr\_bursar | ./modules/ecr | n/a |
155158
| ecr\_carbon | ./modules/ecr | n/a |
159+
| ecr\_cdps\_s3\_bagit\_validator | ./modules/ecr | n/a |
156160
| ecr\_creditcardslips | ./modules/ecr | n/a |
157161
| ecr\_dsc | ./modules/ecr | n/a |
158162
| ecr\_dss | ./modules/ecr | n/a |
@@ -252,6 +256,10 @@ This is a core infrastructure repository that defines infrastructure related to
252256
| ppod\_makefile | Full contents of the Makefile for the ppod repo (allows devs to push to Dev account only) |
253257
| ppod\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the ppod repo |
254258
| ppod\_stage\_build\_workflow | Full contents of the stage-build.yml for the ppod repo |
259+
| s3\_bagit\_validator\_dev\_build\_workflow | Full contents of the dev-build.yml for the s3-bagit-validator repo |
260+
| s3\_bagit\_validator\_makefile | Full contents of the Makefile for the s3-bagit-validator repo (allows devs to push to Dev account only) |
261+
| s3\_bagit\_validator\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the s3-bagit-validator repo |
262+
| s3\_bagit\_validator\_stage\_build\_workflow | Full contents of the stage-build.yml for the s3-bagit-validator repo |
255263
| sapinvoices\_dev\_build\_workflow | Full contents of the dev-build.yml for the alma-sapinvoices repo |
256264
| sapinvoices\_makefile | Full contents of the Makefile for the alma-sapinvoices repo (allows devs to push to Dev account only) |
257265
| sapinvoices\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the alma-sapinvoices repo |

cdps.tf

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
## CDPS related ECRs
2+
3+
# s3-bagit-validator for the CDPS project
4+
# Since this is a Lambda function, we need to set the function name now in
5+
# order to build the correct files.
6+
locals {
7+
ecr_cdps_s3_bagit_validator_function_name = "s3-bagit-validator-${var.environment}"
8+
}
9+
10+
module "ecr_cdps_s3_bagit_validator" {
11+
source = "./modules/ecr"
12+
repo_name = "s3-bagit-validator"
13+
login_policy_arn = aws_iam_policy.login.arn
14+
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
15+
environment = var.environment
16+
tfoutput_ssm_path = var.tfoutput_ssm_path
17+
tags = {
18+
app-repo = "s3-bagit-validator"
19+
}
20+
}
21+
22+
## For s3-bagit-validator application repo and ECR repository
23+
# Outputs in dev
24+
output "s3_bagit_validator_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_cdps_s3_bagit_validator.gha_role
28+
ecr = module.ecr_cdps_s3_bagit_validator.repository_name
29+
function = local.ecr_cdps_s3_bagit_validator_function_name
30+
}
31+
)
32+
description = "Full contents of the dev-build.yml for the s3-bagit-validator repo"
33+
}
34+
output "s3_bagit_validator_makefile" {
35+
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
36+
ecr_name = module.ecr_cdps_s3_bagit_validator.repository_name
37+
ecr_url = module.ecr_cdps_s3_bagit_validator.repository_url
38+
function = local.ecr_cdps_s3_bagit_validator_function_name
39+
}
40+
)
41+
description = "Full contents of the Makefile for the s3-bagit-validator repo (allows devs to push to Dev account only)"
42+
}
43+
44+
# Outputs in stage
45+
output "s3_bagit_validator_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_cdps_s3_bagit_validator.gha_role
49+
ecr = module.ecr_cdps_s3_bagit_validator.repository_name
50+
function = local.ecr_cdps_s3_bagit_validator_function_name
51+
}
52+
)
53+
description = "Full contents of the stage-build.yml for the s3-bagit-validator repo"
54+
}
55+
56+
# Outputs after promotion to prod
57+
output "s3_bagit_validator_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_cdps_s3_bagit_validator.repo_name}-gha-stage"
61+
role_prod = "${module.ecr_cdps_s3_bagit_validator.repo_name}-gha-prod"
62+
ecr_stage = "${module.ecr_cdps_s3_bagit_validator.repo_name}-stage"
63+
ecr_prod = "${module.ecr_cdps_s3_bagit_validator.repo_name}-prod"
64+
function = local.ecr_cdps_s3_bagit_validator_function_name
65+
}
66+
)
67+
description = "Full contents of the prod-promote.yml for the s3-bagit-validator repo"
68+
}

modules/ecr/ssm_outputs.tf

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ resource "aws_ssm_parameter" "ecr_repository_name" {
99
name = "${var.tfoutput_ssm_path}/${var.repo_name}/ecr-repository-name"
1010
value = aws_ecr_repository.this.name
1111
description = "The name of the ${var.repo_name} ECR repository"
12-
overwrite = true
13-
14-
tags = var.tags
12+
tags = var.tags
1513
}
1614

1715
# ecr repository_url
@@ -23,9 +21,7 @@ resource "aws_ssm_parameter" "ecr_repository_url" {
2321
name = "${var.tfoutput_ssm_path}/${var.repo_name}/ecr-repository-url"
2422
value = aws_ecr_repository.this.repository_url
2523
description = "The URL of the ${var.repo_name} ECR repository"
26-
overwrite = true
27-
28-
tags = var.tags
24+
tags = var.tags
2925
}
3026

3127
# ecr role so that we can add the updatefunctioncode to it after the lambda itself is created
@@ -37,7 +33,5 @@ resource "aws_ssm_parameter" "gha_role" {
3733
name = "${var.tfoutput_ssm_path}/${var.repo_name}/gha-role"
3834
value = aws_iam_role.gha_this.name
3935
description = "Github action role used to update the ${var.repo_name} ECR repository"
40-
overwrite = true
41-
42-
tags = var.tags
36+
tags = var.tags
4337
}

0 commit comments

Comments
 (0)