Skip to content

Commit

Permalink
move ecr stuff mack to ecr module
Browse files Browse the repository at this point in the history
  • Loading branch information
sastels committed Apr 17, 2024
1 parent d56acf1 commit 2069de3
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 58 deletions.
21 changes: 21 additions & 0 deletions aws/ecr/ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,24 @@ resource "aws_ecr_repository" "github_arc" {
scan_on_push = true
}
}

resource "aws_ecr_repository" "pinpoint_to_sqs_sms_callbacks" {
# The :latest tag is used in Staging

name = "notify/pinpoint_to_sqs_sms_callbacks"
image_tag_mutability = "MUTABLE" #tfsec:ignore:AWS078
force_delete = var.force_delete_ecr

image_scanning_configuration {
scan_on_push = true
}
}

resource "aws_secretsmanager_secret" "pinpoint_to_sqs_sms_callbacks_repository_url" {
name = "PINPOINT_TO_SQS_SMS_CALLBACKS_REPOSITORY_URL"
}

Check failure

Code scanning / checkov

Ensure Secrets Manager secrets should have automatic rotation enabled Error

Ensure Secrets Manager secrets should have automatic rotation enabled

resource "aws_secretsmanager_secret_version" "pinpoint_to_sqs_sms_callbacks_repository_url" {
secret_id = aws_secretsmanager_secret.pinpoint_to_sqs_sms_callbacks_repository_url.id
secret_string = aws_ecr_repository.pinpoint_to_sqs_sms_callbacks.repository_url
}
22 changes: 22 additions & 0 deletions aws/ecr/images.tf
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,25 @@ resource "null_resource" "push_github_arc_runner_docker_image" {
}

}

# Pinpoint to SQS Queue Build and Push

resource "null_resource" "build_pinpoint_to_sqs_sms_callbacks_docker_image" {
count = var.bootstrap ? 1 : 0
depends_on = [
null_resource.lambda_repo_clone
]

provisioner "local-exec" {
command = "docker build -t ${aws_ecr_repository.pinpoint_to_sqs_sms_callbacks.repository_url}:bootstrap -f /var/tmp/notification-lambdas/pinpointsmscallbacks/Dockerfile /var/tmp/notification-lambdas"
}
}

resource "null_resource" "push_pinpoint_to_sqs_sms_callbacks_docker_image" {
count = var.bootstrap ? 1 : 0
depends_on = [null_resource.build_pinpoint_to_sqs_sms_callbacks_docker_image]

provisioner "local-exec" {
command = "docker push ${aws_ecr_repository.pinpoint_to_sqs_sms_callbacks.repository_url}:bootstrap"
}
}
20 changes: 0 additions & 20 deletions aws/pinpoint_to_sqs_sms_callbacks/ecr.tf

This file was deleted.

38 changes: 0 additions & 38 deletions aws/pinpoint_to_sqs_sms_callbacks/images.tf

This file was deleted.

6 changes: 6 additions & 0 deletions aws/pinpoint_to_sqs_sms_callbacks/lambda.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
variable "lambda_depends_on" {
type = any
default = var.bootstrap ? [null_resource.push_pinpoint_to_sqs_sms_callbacks_docker_image] : []
}

module "pinpoint_to_sqs_sms_callbacks" {
depends_on = [var.lambda_depends_on]
source = "github.com/cds-snc/terraform-modules//lambda?ref=v7.3.3"
name = "pinpoint_to_sqs_sms_callbacks"
billing_tag_value = var.billing_tag_value
Expand Down

0 comments on commit 2069de3

Please sign in to comment.