-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_service.tf
75 lines (65 loc) · 1.81 KB
/
api_service.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
locals {
api_port = 3000
api_domain = "api.mydomain.team"
api_git_repo = "my/my_api"
api_development_git_branch = "dev"
api_ecr_image_development = "${aws_ecr_repository.my_api_ecr.repository_url}:dev"
}
resource "aws_apprunner_service" "my_api" {
depends_on = [
aws_ecr_repository.my_api_ecr,
aws_iam_role.my_app_runner_roles,
aws_apprunner_vpc_connector.my_vpc_connector
]
service_name = "my_api"
source_configuration {
authentication_configuration {
access_role_arn = aws_iam_role.my_app_runner_roles.arn
}
image_repository {
image_identifier = local.api_ecr_image_development
image_repository_type = "ECR"
image_configuration {
port = 3000
runtime_environment_variables = {
# Server Port
PORT = "3000"
#
NODE_ENV = "development"
LOG_LEVEL = "debug"
PORT = local.api_port
CONTAINER_PORT = local.api_port
HOST_PORT = local.api_port
}
runtime_environment_secrets = {
}
}
}
auto_deployments_enabled = true
}
health_check_configuration {
path = "/api/healthcheck"
healthy_threshold = 1
interval = 5
protocol = "HTTP"
timeout = 20
unhealthy_threshold = 20
}
instance_configuration {
cpu = "2048"
memory = "4096"
}
network_configuration {
egress_configuration {
egress_type = "VPC"
vpc_connector_arn = aws_apprunner_vpc_connector.my_vpc_connector.arn
}
}
tags = {
Name = "my-my_api-apprunner-service"
}
}
output "my_api_apprunner_my_api_service_url" {
value = aws_apprunner_service.my_api.service_url
description = ""
}