generated from MITLibraries/mitlib-tf-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalmahook_ecr.tf
68 lines (63 loc) · 2.84 KB
/
almahook_ecr.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# alma-webhook-lambdas
# Since this is a Lambda function, we need to set the function name now
# in order to build the correct files.
locals {
ecr_alma_webhook_lambdas_function_name = "alma-webhook-lambdas-${var.environment}"
}
module "ecr_alma_webhook_lambdas" {
source = "./modules/ecr"
repo_name = "alma-webhook-lambdas"
login_policy_arn = aws_iam_policy.login.arn
oidc_arn = data.aws_ssm_parameter.oidc_arn.value
environment = var.environment
tfoutput_ssm_path = var.tfoutput_ssm_path
tags = {
app-repo = "alma-webhook-lambdas"
}
}
## Outputs to Terraform Cloud for devs ##
## For alma-webhook-lambdas application repo and ECR repository
# Outputs in dev
output "alma_webhook_lambdas_dev_build_workflow" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
region = var.aws_region
role = module.ecr_alma_webhook_lambdas.gha_role
ecr = module.ecr_alma_webhook_lambdas.repository_name
function = local.ecr_alma_webhook_lambdas_function_name
}
)
description = "Full contents of the dev-build.yml for the alma-webhook-lambdas repo"
}
output "alma_webhook_lambdas_makefile" {
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
ecr_name = module.ecr_alma_webhook_lambdas.repository_name
ecr_url = module.ecr_alma_webhook_lambdas.repository_url
function = local.ecr_alma_webhook_lambdas_function_name
}
)
description = "Full contents of the Makefile for the alma-webhook-lambdas repo (allows devs to push to Dev account only)"
}
# Outputs in stage
output "alma_webhook_lambdas_stage_build_workflow" {
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
region = var.aws_region
role = module.ecr_alma_webhook_lambdas.gha_role
ecr = module.ecr_alma_webhook_lambdas.repository_name
function = local.ecr_alma_webhook_lambdas_function_name
}
)
description = "Full contents of the stage-build.yml for the alma-webhook-lambdas repo"
}
# Outputs after promotion to prod
output "alma_webhook_lambdas_prod_promote_workflow" {
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
region = var.aws_region
role_stage = "${module.ecr_alma_webhook_lambdas.repo_name}-gha-stage"
role_prod = "${module.ecr_alma_webhook_lambdas.repo_name}-gha-prod"
ecr_stage = "${module.ecr_alma_webhook_lambdas.repo_name}-stage"
ecr_prod = "${module.ecr_alma_webhook_lambdas.repo_name}-prod"
function = local.ecr_alma_webhook_lambdas_function_name
}
)
description = "Full contents of the prod-promote.yml for the alma-webhook-lambdas repo"
}