Skip to content

Commit 48287f8

Browse files
authored
Merge pull request #56 from MITLibraries/dev
Dev-to-Stage: Create ECR Repository for CDPS-CURT (re-do)
2 parents 2bae135 + 4dc2abd commit 48287f8

File tree

2 files changed

+74
-3
lines changed

2 files changed

+74
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ 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-
9392
## Related Assets
9493

9594
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:
@@ -101,6 +100,9 @@ This is a core infrastructure repository that defines infrastructure related to
101100
* [ASATI](https://github.com/MITLibraries/mitlib-tf-workloads-asati)
102101
* [ASATI Application Container](https://github.com/MITLibraries/asati)
103102
* [Carbon](https://github.com/MITLibraries/mitlib-tf-workloads-carbon)
103+
* [CDPS](https://github.com/MITLibraries/mitlib-tf-workloads-cdps-storage)
104+
* [S3 BagIt Validator](https://github.com/MITLibraries/s3-bagit-validator)
105+
* [CDPS CURT](https://github.com/MITLibraries/cdps-curt)
104106
* [DSC](https://github.com/MITLibraries/mitlib-tf-workloads-dsc)
105107
* [DSC Application Container](https://github.com/MITLibraries/dspace-submission-composer)
106108
* [DSS](https://github.com/MITLibraries/mitlib-tf-workloads-dss)
@@ -112,8 +114,6 @@ This is a core infrastructure repository that defines infrastructure related to
112114
* [Matomo Application Container](https://github.com/MITLibraries/docker-matomo)
113115
* [PPOD](https://github.com/MITLibraries/mitlib-tf-workloads-ppod)
114116
* [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)
117117
* [TIMDEX](https://github.com/MITLibraries/mitlib-tf-workloads-timdex-infrastructure)
118118
* [TIMDEX Application Container](https://github.com/MITLibraries/timdex)
119119
* [TIMDEX Dataset API](https://github.com/MITLibraries/timdex-dataset-api)
@@ -156,6 +156,7 @@ This is a core infrastructure repository that defines infrastructure related to
156156
| ecr\_asati | ./modules/ecr | n/a |
157157
| ecr\_bursar | ./modules/ecr | n/a |
158158
| ecr\_carbon | ./modules/ecr | n/a |
159+
| ecr\_cdps\_curt | ./modules/ecr | n/a |
159160
| ecr\_cdps\_s3\_bagit\_validator | ./modules/ecr | n/a |
160161
| ecr\_creditcardslips | ./modules/ecr | n/a |
161162
| ecr\_dsc | ./modules/ecr | n/a |
@@ -220,6 +221,10 @@ This is a core infrastructure repository that defines infrastructure related to
220221
| carbon\_makefile | Full contents of the Makefile for the carbon repo (allows devs to push to Dev account only) |
221222
| carbon\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the carbon repo |
222223
| carbon\_stage\_build\_workflow | Full contents of the stage-build.yml for the carbon repo |
224+
| cdps\_curt\_dev\_build\_workflow | Full contents of the dev-build.yml for the cdps-curt repo |
225+
| cdps\_curt\_makefile | Full contents of the Makefile for the cdps-curt repo (allows devs to push to Dev account only) |
226+
| cdps\_curt\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the cdps-curt repo |
227+
| cdps\_curt\_stage\_build\_workflow | Full contents of the stage-build.yml for the cdps-curt repo |
223228
| creditcardslips\_dev\_build\_workflow | Full contents of the dev-build.yml for the alma-creditcardslips repo |
224229
| creditcardslips\_makefile | Full contents of the Makefile for the alma-creditcardslips repo (allows devs to push to Dev account only) |
225230
| creditcardslips\_prod\_promote\_workflow | Full contents of the prod-promote.yml for the alma-creditcardslips repo |

cdps.tf

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## CDPS related ECRs
22

3+
##############################################################################
34
# s3-bagit-validator for the CDPS project
45
# Since this is a Lambda function, we need to set the function name now in
56
# order to build the correct files.
@@ -66,3 +67,68 @@ output "s3_bagit_validator_prod_promote_workflow" {
6667
)
6768
description = "Full contents of the prod-promote.yml for the s3-bagit-validator repo"
6869
}
70+
71+
72+
##############################################################################
73+
# cdps-curt for the CDPS project
74+
# This is a Fargate task, so no need for a Lambda function name
75+
76+
module "ecr_cdps_curt" {
77+
source = "./modules/ecr"
78+
repo_name = "cdps-curt"
79+
login_policy_arn = aws_iam_policy.login.arn
80+
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
81+
environment = var.environment
82+
tfoutput_ssm_path = var.tfoutput_ssm_path
83+
tags = {
84+
app-repo = "cdps-curt"
85+
}
86+
}
87+
88+
## For cdps-curt application repo and ECR repository
89+
# Outputs in dev
90+
output "cdps_curt_dev_build_workflow" {
91+
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
92+
region = var.aws_region
93+
role = module.ecr_cdps_curt.gha_role
94+
ecr = module.ecr_cdps_curt.repository_name
95+
function = ""
96+
}
97+
)
98+
description = "Full contents of the dev-build.yml for the cdps-curt repo"
99+
}
100+
output "cdps_curt_makefile" {
101+
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
102+
ecr_name = module.ecr_cdps_curt.repository_name
103+
ecr_url = module.ecr_cdps_curt.repository_url
104+
function = ""
105+
}
106+
)
107+
description = "Full contents of the Makefile for the cdps-curt repo (allows devs to push to Dev account only)"
108+
}
109+
110+
# Outputs in stage
111+
output "cdps_curt_stage_build_workflow" {
112+
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
113+
region = var.aws_region
114+
role = module.ecr_cdps_curt.gha_role
115+
ecr = module.ecr_cdps_curt.repository_name
116+
function = ""
117+
}
118+
)
119+
description = "Full contents of the stage-build.yml for the cdps-curt repo"
120+
}
121+
122+
# Outputs after promotion to prod
123+
output "cdps_curt_prod_promote_workflow" {
124+
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
125+
region = var.aws_region
126+
role_stage = "${module.ecr_cdps_curt.repo_name}-gha-stage"
127+
role_prod = "${module.ecr_cdps_curt.repo_name}-gha-prod"
128+
ecr_stage = "${module.ecr_cdps_curt.repo_name}-stage"
129+
ecr_prod = "${module.ecr_cdps_curt.repo_name}-prod"
130+
function = ""
131+
}
132+
)
133+
description = "Full contents of the prod-promote.yml for the cdps-curt repo"
134+
}

0 commit comments

Comments
 (0)