Skip to content

Commit 08e9737

Browse files
committed
Create CDPS ECRs in Multiple Regions
Why these changes are being introduced: We need the `s3-bagit-validator` container in ECR Repositories in us-east-1 and us-west-2. How this addresses that need: * Add an additional AWS Provider alias for us-west-2 * Create a new file for the us-west-2 ECR Repository for s3-bagit-validator * Rename the old cdps ECR file to clarify where the resources are getting created * Add a us-west-2 module call for the s3-bagit-validator ECR creation Side effects of this change: None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IR-238
1 parent 53d4c9c commit 08e9737

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ This is a core infrastructure repository that defines infrastructure related to
161161
| ecr\_carbon | ./modules/ecr | n/a |
162162
| ecr\_cdps\_curt | ./modules/ecr | n/a |
163163
| ecr\_cdps\_s3\_bagit\_validator | ./modules/ecr | n/a |
164+
| ecr\_cdps\_s3\_bagit\_validator\_west | ./modules/ecr | n/a |
164165
| ecr\_creditcardslips | ./modules/ecr | n/a |
165166
| ecr\_dsc | ./modules/ecr | n/a |
166167
| ecr\_dss | ./modules/ecr | n/a |
File renamed without changes.

cdps_ecrs_west.tf

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
##############################################################################
2+
# s3-bagit-validator for the CDPS project in the us-west-2 region
3+
# We use the same locals block as the _default
4+
5+
module "ecr_cdps_s3_bagit_validator_west" {
6+
source = "./modules/ecr"
7+
providers = {
8+
aws = aws.west-2
9+
}
10+
repo_name = "s3-bagit-validator"
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 = "s3-bagit-validator"
17+
}
18+
}
19+
20+
# ## For s3-bagit-validator application repo and ECR repository
21+
# # Outputs in dev
22+
# output "s3_bagit_validator_dev_build_workflow_west" {
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_cdps_s3_bagit_validator_west.gha_role
26+
# ecr = module.ecr_cdps_s3_bagit_validator_west.repository_name
27+
# function = local.ecr_cdps_s3_bagit_validator_function_name
28+
# }
29+
# )
30+
# description = "Full contents of the dev-build.yml for the s3-bagit-validator repo to deploy in us-west-2"
31+
# }
32+
# output "s3_bagit_validator_makefile_west" {
33+
# value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
34+
# ecr_name = module.ecr_cdps_s3_bagit_validator_west.repository_name
35+
# ecr_url = module.ecr_cdps_s3_bagit_validator_west.repository_url
36+
# function = local.ecr_cdps_s3_bagit_validator_function_name
37+
# }
38+
# )
39+
# description = "Full contents of the Makefile for the s3-bagit-validator repo (allows devs to push to Dev account only)"
40+
# }
41+
42+
# # Outputs in stage
43+
# output "s3_bagit_validator_stage_build_workflow_west" {
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_cdps_s3_bagit_validator_west.gha_role
47+
# ecr = module.ecr_cdps_s3_bagit_validator_west.repository_name
48+
# function = local.ecr_cdps_s3_bagit_validator_function_name
49+
# }
50+
# )
51+
# description = "Full contents of the stage-build.yml for the s3-bagit-validator repo to deploy in us-west-2"
52+
# }
53+
54+
# # Outputs after promotion to prod
55+
# output "s3_bagit_validator_prod_promote_workflow_west" {
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_cdps_s3_bagit_validator_west.repo_name}-gha-stage"
59+
# role_prod = "${module.ecr_cdps_s3_bagit_validator_west.repo_name}-gha-prod"
60+
# ecr_stage = "${module.ecr_cdps_s3_bagit_validator_west.repo_name}-stage"
61+
# ecr_prod = "${module.ecr_cdps_s3_bagit_validator_west.repo_name}-prod"
62+
# function = local.ecr_cdps_s3_bagit_validator_function_name
63+
# }
64+
# )
65+
# description = "Full contents of the prod-promote.yml for the s3-bagit-validator repo to deploy in us-west-2"
66+
# }

providers.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,20 @@ provider "aws" {
2424
}
2525
}
2626
}
27+
28+
# NEed additional region for multi-region containers
29+
provider "aws" {
30+
alias = "west-2"
31+
region = "us-west-2"
32+
default_tags {
33+
tags = {
34+
project-id = local.project_id == null ? null : "${local.project_id}"
35+
app-id = var.name
36+
environment = var.environment
37+
ou = var.ou
38+
terraform = "true"
39+
infra-repo = "mitlib-tf-${var.ou}-${var.name}"
40+
contains-pii = "false"
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)