Skip to content

Commit

Permalink
[#246] Create ECR repo for backend base image and update IAM policy
Browse files Browse the repository at this point in the history
This commit introduces a new Terraform module instantiation for creating
an AWS ECR repository dedicated to the backend base Docker image. The
repository, named `backend-base`, is aimed at storing pre-compiled
dependencies for the backend, in line with the project's goal to speed
up build and deployment times.

Changes to `infra/terraform/main.tf` include the addition of the
`govtool-ecr-backend-base` module, specifying the `backend-base` as the
repository name. This ensures a separate and organized repository for
the base image, facilitating better management and access control.

Furthermore, the AWS IAM policy `cicd_ecr` is updated to include
permissions for the new `backend-base` repository. This adjustment
allows CI/CD pipelines to push and pull images, ensuring seamless
integration with existing workflows.

The outputs are also expanded to include the URL of the newly created
`backend-base` ECR repository, enhancing accessibility for deployment
scripts and CI/CD pipelines.

This setup supports the acceptance criteria by establishing the
necessary infrastructure to store and manage the base image, ultimately
contributing to reduced deployment times.
  • Loading branch information
placek authored and MSzalowski committed Feb 23, 2024
1 parent 207b3be commit c39c44d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions infra/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ module "govtool-ecr-backend" {
repo_name = "backend"
}

module "govtool-ecr-backend-base" {
source = "./modules/ecr"
repo_name = "backend-base"
}

module "govtool-ecr-frontend" {
source = "./modules/ecr"
repo_name = "frontend"
Expand All @@ -33,6 +38,7 @@ resource "aws_iam_policy" "cicd_ecr" {
Effect = "Allow"
Resource = [
module.govtool-ecr-backend.repo_arn,
module.govtool-ecr-backend-base.repo_arn,
module.govtool-ecr-frontend.repo_arn
]
},
Expand Down Expand Up @@ -91,6 +97,10 @@ output "govtool-ecr-backend-url" {
value = module.govtool-ecr-backend.repo_url
}

output "govtool-ecr-backend-base-url" {
value = module.govtool-ecr-backend-base.repo_url
}

output "govtool-ecr-frontend-url" {
value = module.govtool-ecr-frontend.repo_url
}
Expand Down

0 comments on commit c39c44d

Please sign in to comment.