added model directory s3 bucket and prediction lambda (sap) ecr

This commit is contained in:
Khalim Conn-Kowlessar 2023-08-31 13:50:51 +01:00
parent 0bd0052934
commit e1774d4be5
3 changed files with 20 additions and 7 deletions

View file

@ -96,6 +96,13 @@ module "s3" {
allowed_origins = var.allowed_origins
}
module "s3" {
source = "./modules/s3"
bucketname = "retrofit-model-directory-${var.stage}"
allowed_origins = var.allowed_origins
}
# Set up the route53 record for the API
module "route53" {
source = "./modules/route53"
@ -108,6 +115,11 @@ module "route53" {
# Create an ECR repository for storage of the lambda's docker images
module "ecr" {
source = "./modules/ecr"
environment = var.stage
name = "fastapi-repository-${var.environment}"
source = "./modules/ecr"
}
module "ecr" {
name = "lambda-sap-prediction-${var.environment}"
source = "./modules/ecr"
}

View file

@ -1,6 +1,7 @@
resource "aws_ecr_repository" "my_repository" {
name = "fastapi-repository-${var.environment}"
image_tag_mutability = "MUTABLE" # Allows overwriting image tags, change to IMMUTABLE if you want to prevent overwriting
name = "${var.ecr_name}"
image_tag_mutability = "MUTABLE"
# Allows overwriting image tags, change to IMMUTABLE if you want to prevent overwriting
image_scanning_configuration {
scan_on_push = true
@ -15,7 +16,7 @@ resource "aws_ecr_lifecycle_policy" "my_repository_policy" {
{
rulePriority = 1
description = "Retain only the last 10 images"
selection = {
selection = {
tagStatus = "any"
countType = "imageCountMoreThan"
countNumber = 10

View file

@ -1,4 +1,4 @@
variable "environment" {
description = "The environment for the ECR repository (dev or prod)"
variable "ecr_name" {
description = "The name for the ECR repository"
type = string
}