Skip to content

Commit

Permalink
fix: ecr universal
Browse files Browse the repository at this point in the history
  • Loading branch information
ghannay10 committed Apr 4, 2024
1 parent d48d5ce commit b851684
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 12 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ tf_apply: ## Apply terraform
make tf_set_workspace && \
terraform -chdir=./infrastructure apply -var-file=$(CONFIG_DIR)/${env}-input-params.tfvars ${tf_build_args}

.PHONY: tf_init_universal
tf_init_universal: ## Initialise terraform
terraform -chdir=./infrastructure/universal init -backend-config=../$(TF_BACKEND_CONFIG)

.PHONY: tf_apply_universal
tf_apply_universal: ## Apply terraform
make tf_set_workspace && \
terraform -chdir=./infrastructure/universal apply -var-file=../$(CONFIG_DIR)/prod-input-params.tfvars ${tf_build_args}
terraform -chdir=./infrastructure workspace select prod && \
terraform -chdir=./infrastructure/universal apply -var-file=../$(CONFIG_DIR)/prod-input-params.tfvars

.PHONY: tf_auto_apply
tf_auto_apply: ## Auto apply terraform
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/batch.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

locals {
batch_image_ecr_url = data.aws_ecr_repository.existing[0].repository_url != null ? data.aws_ecr_repository.existing[0].repository_url : module.ecr.ecr_repository_url
batch_image_ecr_url = var.ecr_repository_uri
}

module "batch_compute" {
Expand Down
5 changes: 2 additions & 3 deletions infrastructure/data.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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"
}

data "terraform_remote_state" "vpc" {
Expand All @@ -25,7 +25,6 @@ data "terraform_remote_state" "platform" {
}



data "terraform_remote_state" "universal" {
backend = "s3"
config = {
Expand Down
10 changes: 5 additions & 5 deletions infrastructure/universal/ecr.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module "ecr" {
source = "../../../i-ai-core-infrastructure//modules/ecr"
project_name = var.project_name
locals {
container_name_suffix = null
ecr_name = local.container_name_suffix != null ? "${var.project_name}-${local.container_name_suffix}" : var.project_name
}

locals {
module "ecr" {
source = "../../../i-ai-core-infrastructure//modules/ecr"
project_name = var.project_name
container_name_suffix = null
ecr_name = local.container_name_suffix != null ? "${var.project_name}-${local.container_name_suffix}" : var.project_name
}
26 changes: 26 additions & 0 deletions infrastructure/universal/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.53.0"
}
}
required_version = ">= 1.3.5"

backend "s3" {
key = "consultation-analyser/universal-terraform.tfstate"
}

}

provider "random" {

}

provider "aws" {
default_tags {
tags = {
Environment = "prod"
}
}
}
1 change: 0 additions & 1 deletion infrastructure/universal/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

variable "project_name" {
type = string
description = "Name of project"
Expand Down

0 comments on commit b851684

Please sign in to comment.