Skip to content

Commit

Permalink
Merge pull request #39 from i-dot-ai/feature/add-batch
Browse files Browse the repository at this point in the history
making changes for aws-batch
  • Loading branch information
MotwaniM authored Mar 25, 2024
2 parents 24ebfb4 + 01edce1 commit 420907d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build-infrastructure
on:
push:
branches:
- feature/integrate_actions
- main

jobs:
set-vars:
Expand Down
26 changes: 26 additions & 0 deletions infrastructure/batch.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@


module "batch_compute" {
source = "../../i-ai-core-infrastructure/modules/batch/batch_compute_environment/"
project = "i-dot-ai"
name = "consultations"
region = var.region
vpc_id = data.terraform_remote_state.vpc.outputs.vpc_id
desired_vcpus = 0
min_vcpus = 0
max_vcpus = 20
private_subnets = data.terraform_remote_state.vpc.outputs.private_subnets
state_bucket = var.state_bucket

}

module "batch_job_defintiion" {
source = "../../i-ai-core-infrastructure/modules/batch/batch_job_definitons/"
project = "i-dot-ai"
name = "consultations"
region = var.region
compute_environment_arn = module.batch_compute.compute_environment_arn
state_bucket = var.state_bucket
image = module.ecr_back_end.repository_url
fargate_flag = false
}
8 changes: 6 additions & 2 deletions infrastructure/data.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
locals {
record_prefix = var.env == "prod" ? var.project_name : "${var.project_name}-${var.env}"
host = terraform.workspace == "prod" ? "${var.project_name}.ai.cabinetoffice.gov.uk" : "${var.project_name}-${terraform.workspace}.ai.cabinetoffice.gov.uk"
record_prefix = var.env == "prod" ? var.project_name : "${var.project_name}-${var.env}"
host = terraform.workspace == "prod" ? "${var.project_name}.ai.cabinetoffice.gov.uk" : "${var.project_name}-${terraform.workspace}.ai.cabinetoffice.gov.uk"
image_tag_frontend_test = "a07a0d03cfd1aeebf6baed86b7dccf4d79504405"

image_frontend =

}

data "terraform_remote_state" "vpc" {
Expand Down
8 changes: 7 additions & 1 deletion infrastructure/ecr.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@

module "ecr" {
module "ecr_front_end" {
source = "../../i-ai-core-infrastructure//modules/ecr"

project_name_prefix = var.project_name
container_name = "front-end"
}

module "ecr_back_end" {
source = "../../i-ai-core-infrastructure//modules/ecr"
project_name_prefix = var.project_name
container_name = "pre-processing"
}
5 changes: 2 additions & 3 deletions infrastructure/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module "ecs" {
project_name = var.project_name
image_tag = "a07a0d03cfd1aeebf6baed86b7dccf4d79504405"
prefix = "i-dot-ai"
ecr_repository_uri = var.ecr_repository_uri
ecs_cluster_id = data.terraform_remote_state.platform.outputs.ecs_cluster_id
ecr_repository_uri = module.ecr_front_end.repository_url
cluster_name = data.terraform_remote_state.platform.outputs.ecs_cluster_id
health_check = {
healthy_threshold = 3
unhealthy_threshold = 3
Expand All @@ -19,7 +19,6 @@ module "ecs" {
container_port = "80"
load_balancer_security_group = data.terraform_remote_state.platform.outputs.load_balancer_security_group_id["default"]
aws_lb_arn = data.terraform_remote_state.platform.outputs.load_balancer_arn["default"]
host = local.host
}


Expand Down

0 comments on commit 420907d

Please sign in to comment.