|
| 1 | + |
| 2 | +# ecr-workflow-test containers |
| 3 | +# This is a standard ECR for an ECS with a Fargate launch type |
| 4 | +locals { |
| 5 | + ecr_workflowtest = "workflowtest-${var.environment}" |
| 6 | +} |
| 7 | +module "ecr_workflowtest" { |
| 8 | + source = "./modules/ecr" |
| 9 | + repo_name = "ecr-workflow-test" |
| 10 | + login_policy_arn = aws_iam_policy.login.arn |
| 11 | + oidc_arn = data.aws_ssm_parameter.oidc_arn.value |
| 12 | + environment = var.environment |
| 13 | + tfoutput_ssm_path = var.tfoutput_ssm_path |
| 14 | + tags = { |
| 15 | + app-repo = "ecr-workflow-test" |
| 16 | + } |
| 17 | +} |
| 18 | + |
| 19 | + |
| 20 | +## Outputs to Terraform Cloud for devs ## |
| 21 | + |
| 22 | +## For workflowtest application repo and ECR repository |
| 23 | +# Outputs in dev |
| 24 | +output "workflowtest_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_workflowtest.gha_role |
| 28 | + ecr = module.ecr_workflowtest.repository_name |
| 29 | + function = "" |
| 30 | + } |
| 31 | + ) |
| 32 | + description = "Full contents of the dev-build.yml for the ecr-workflow-test repo" |
| 33 | +} |
| 34 | +output "workflowtest_makefile" { |
| 35 | + value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", { |
| 36 | + ecr_name = module.ecr_workflowtest.repository_name |
| 37 | + ecr_url = module.ecr_workflowtest.repository_url |
| 38 | + function = "" |
| 39 | + } |
| 40 | + ) |
| 41 | + description = "Full contents of the Makefile for the ecr-workflow-test repo (allows devs to push to Dev account only)" |
| 42 | +} |
| 43 | + |
| 44 | +# Outputs in stage |
| 45 | +output "workflowtest_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_workflowtest.gha_role |
| 49 | + ecr = module.ecr_workflowtest.repository_name |
| 50 | + function = "" |
| 51 | + } |
| 52 | + ) |
| 53 | + description = "Full contents of the stage-build.yml for the ecr-workflow-test repo" |
| 54 | +} |
| 55 | + |
| 56 | +# Outputs after promotion to prod |
| 57 | +output "workflowtest_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_workflowtest.repo_name}-gha-stage" |
| 61 | + role_prod = "${module.ecr_workflowtest.repo_name}-gha-prod" |
| 62 | + ecr_stage = "${module.ecr_workflowtest.repo_name}-stage" |
| 63 | + ecr_prod = "${module.ecr_workflowtest.repo_name}-prod" |
| 64 | + function = "" |
| 65 | + } |
| 66 | + ) |
| 67 | + description = "Full contents of the prod-promote.yml for the ecr-workflow-test repo" |
| 68 | +} |
0 commit comments