|
| 1 | +# Tacos Detectors (tacos-detectors-lambdas) containers |
| 2 | +# A standard ECR for an ECS Fargate task |
| 3 | + |
| 4 | +locals { |
| 5 | + ecr_tacos_detectors = "tacos-detectors-lambdas-${var.environment}" |
| 6 | +} |
| 7 | + |
| 8 | +module "ecr_tacos_detectors" { |
| 9 | + source = "./modules/ecr" |
| 10 | + repo_name = "tacos-detectors-lambdas" |
| 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 = "tacos-detectors-lambdas" |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +## Outputs to Terraform Cloud for devs ## |
| 21 | + |
| 22 | +## For tacos-detectors-lambdas application repo and ECR repository |
| 23 | +# Outputs in dev |
| 24 | +output "tacos_detectors_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_tacos_detectors.gha_role |
| 28 | + ecr = module.ecr_tacos_detectors.repository_name |
| 29 | + function = local.ecr_tacos_detectors |
| 30 | + } |
| 31 | + ) |
| 32 | + description = "Full contents of the dev-build.yml for the tacos-detectors-lambdas repo" |
| 33 | +} |
| 34 | +output "tacos_detectors_makefile" { |
| 35 | + value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", { |
| 36 | + ecr_name = module.ecr_tacos_detectors.repository_name |
| 37 | + ecr_url = module.ecr_tacos_detectors.repository_url |
| 38 | + function = local.ecr_tacos_detectors |
| 39 | + } |
| 40 | + ) |
| 41 | + description = "Full contents of the Makefile for the tacos-detectors-lambdas repo (allows devs to push to Dev account only)" |
| 42 | +} |
| 43 | + |
| 44 | +# Outputs in stage |
| 45 | +output "tacos_detectors_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_tacos_detectors.gha_role |
| 49 | + ecr = module.ecr_tacos_detectors.repository_name |
| 50 | + function = local.ecr_tacos_detectors |
| 51 | + } |
| 52 | + ) |
| 53 | + description = "Full contents of the stage-build.yml for the tacos-detectors-lambdas repo" |
| 54 | +} |
| 55 | + |
| 56 | +# Outputs after promotion to prod |
| 57 | +output "tacos_detectors_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_tacos_detectors.repo_name}-gha-stage" |
| 61 | + role_prod = "${module.ecr_tacos_detectors.repo_name}-gha-prod" |
| 62 | + ecr_stage = "${module.ecr_tacos_detectors.repo_name}-stage" |
| 63 | + ecr_prod = "${module.ecr_tacos_detectors.repo_name}-prod" |
| 64 | + function = local.ecr_tacos_detectors |
| 65 | + } |
| 66 | + ) |
| 67 | + description = "Full contents of the prod-promote.yml for the tacos-detectors-lambdas repo" |
| 68 | +} |
0 commit comments