indiana-university / automated-transcription-service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create ECR images using Terraform

alan-walsh opened this issue · comments

Can/should we automate the creation of the ECR container images using Terraform? CI/CD? Probably.

Becca has done some preliminary work on this:

/*
resource aws_ecr_repository repo {
name = local.ecr_repository_name
}
*/

/resource null_resource ecr_image {
triggers = {
python_file = var.python
docker_file = var.docker
}
}
/

/*
resource "aws_instance" "exec" {
#provisioner "local-exec" {
command = <<EOF
aws ecr get-login-password --region ${var.region} | docker login --username AWS --password-stdin ${local.account_id}.dkr.ecr.${var.region}.amazonaws.com
cd ${path.module}/lambdas/git_client
docker build -t ${aws_ecr_repository.repo.repository_url}:${local.ecr_image_tag} .
docker push ${aws_ecr_repository.repo.repository_url}:${local.ecr_image_tag}
EOF
}
#do I need to include a path to requirements.txt?
*/

/*
data aws_ecr_image lambda_image {
depends_on = [
null_resource.ecr_image
]
repository_name = local.ecr_repository_name
image_tag = local.ecr_image_tag
}
*/

/*
data "aws_iam_policy_document" "lambda_docx" {
statement {
actions = [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
]
effect = "Allow"
resources = [""]
sid = "Create WatchLogs"
}
statement {
actions = [
"codecommit:GitPull",
"codecommit:GitPush",
"codecommit:GetBranch",
"codecommit:ListBranches",
"codecommit:CreateCommit",
"codecommit:GetCommit",
"codecommit:GetCommitHistory",
"codecommit:GetDifferences",
"codecommit:GetReferences",
"codecommit:BatchGetCommits",
"codecommit:GetTree",
"codecommit:GetObjectIdentifier",
"codecommit:GetMergeCommit"
]
effect = "Allow"
resources = [""]
sid = "CodeCommit"
}
}

resource "aws_iam_policy" "lambda_docx" {
name = "${local.prefix}-lambda-policy"
path = "/"
policy = data.aws_iam_policy_document.lambda.json
}
*/

/*
environment {
variables = {
#BUCKET = "aws_s3_bucket.upload.id",
MPLCONFIGDIR = "/tmp",
WEBHOOK_URL = "https://indiana.webhook.office.com/webhookb2/xxxxxxxxxxx...",
BUCKET = "aws_s3_bucket.download.id"
}
}
*/