Skip to content

Commit 99d29f3

Browse files
committed
decom App Runner
1 parent e867cd8 commit 99d29f3

File tree

7 files changed

+16
-186
lines changed

7 files changed

+16
-186
lines changed

tf/apprunner.tf

Lines changed: 0 additions & 108 deletions
This file was deleted.

tf/cloudfront.tf

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,6 @@ resource "aws_cloudfront_distribution" "main" {
6464
}
6565
}
6666

67-
origin {
68-
origin_id = "apprunner"
69-
domain_name = replace(aws_apprunner_service.main[0].service_url, "https://", "")
70-
origin_path = null
71-
connection_attempts = 3
72-
connection_timeout = 10
73-
custom_header {
74-
name = "x-forwarded-host"
75-
value = var.app_domain
76-
}
77-
custom_origin_config {
78-
http_port = 80
79-
https_port = 443
80-
origin_read_timeout = 30
81-
origin_keepalive_timeout = 5
82-
origin_protocol_policy = "https-only"
83-
origin_ssl_protocols = ["TLSv1.2"]
84-
}
85-
}
86-
8767
ordered_cache_behavior {
8868
target_origin_id = "functionurl"
8969
path_pattern = "/vite/*"

tf/iam_GhaSponsorDeploy.tf

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -78,31 +78,6 @@ data "aws_iam_policy_document" "GhaSponsorDeploy" {
7878
resources = ["arn:aws:ecs:us-west-2:${data.aws_caller_identity.current.account_id}:service/*/sponsor-*"]
7979
}
8080

81-
# AppRunner permissions (only when AppRunner is enabled)
82-
dynamic "statement" {
83-
for_each = var.enable_app ? [1] : []
84-
content {
85-
effect = "Allow"
86-
actions = [
87-
"apprunner:DescribeService",
88-
"apprunner:UpdateService",
89-
"apprunner:ListOperations",
90-
"apprunner:ListTagsForResource",
91-
]
92-
resources = [
93-
aws_apprunner_service.main[0].arn,
94-
]
95-
}
96-
}
97-
98-
statement {
99-
effect = "Allow"
100-
actions = [
101-
"apprunner:ListServices",
102-
]
103-
resources = ["*"]
104-
}
105-
10681
statement {
10782
effect = "Allow"
10883
actions = [
@@ -117,13 +92,10 @@ data "aws_iam_policy_document" "GhaSponsorDeploy" {
11792
actions = [
11893
"iam:PassRole",
11994
]
120-
resources = concat(
121-
[
122-
aws_iam_role.SponsorApp.arn,
123-
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/EcsExecSponsorApp",
124-
],
125-
var.enable_app ? [aws_iam_role.app-runner-access[0].arn] : []
126-
)
95+
resources = [
96+
aws_iam_role.SponsorApp.arn,
97+
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/EcsExecSponsorApp",
98+
]
12799
}
128100

129101
statement {
@@ -165,10 +137,7 @@ data "aws_iam_policy_document" "GhaSponsorDeploy" {
165137
"iam:ListRolePolicies",
166138
"iam:ListAttachedRolePolicies",
167139
]
168-
resources = concat(
169-
[aws_iam_role.SponsorApp.arn],
170-
var.enable_app ? [aws_iam_role.app-runner-access[0].arn] : []
171-
)
140+
resources = [aws_iam_role.SponsorApp.arn]
172141
}
173142

174143
statement {

tf/iam_SponsorApp.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ resource "aws_iam_role" "SponsorApp" {
66
}
77

88
data "aws_iam_policy_document" "SponsorApp-trust" {
9-
# Service principal trust for AppRunner, ECS, and Lambda (always enabled)
9+
# Service principal trust for ECS and Lambda (always enabled)
1010
statement {
1111
effect = "Allow"
1212
actions = ["sts:AssumeRole"]
1313
principals {
1414
type = "Service"
1515
identifiers = [
1616
"ecs-tasks.amazonaws.com",
17-
"tasks.apprunner.amazonaws.com",
1817
"lambda.amazonaws.com",
1918
]
2019
}

tf/lambda.tf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ resource "aws_lambda_function" "app" {
4444
Environment = var.environment
4545
}
4646

47-
#lifecycle {
48-
# ignore_changes = [
49-
# image_uri,
50-
# ]
51-
#}
47+
lifecycle {
48+
ignore_changes = [
49+
image_uri,
50+
]
51+
}
5252
}
5353

5454
resource "aws_lambda_event_source_mapping" "lambdakiq" {
@@ -60,3 +60,8 @@ resource "aws_lambda_event_source_mapping" "lambdakiq" {
6060

6161
function_response_types = ["ReportBatchItemFailures"]
6262
}
63+
64+
output "lambda_env" {
65+
value = merge(local.environments, {
66+
})
67+
}

tf/outputs.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,3 @@ output "sqs_queue_url" {
3737
value = var.enable_sqs ? aws_sqs_queue.activejob[0].url : null
3838
description = "SQS queue URL for ActiveJob"
3939
}
40-
41-
output "apprunner_service_url" {
42-
value = var.enable_app ? aws_apprunner_service.main[0].service_url : null
43-
description = "App Runner service URL"
44-
}

tf/variables.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ variable "name" {
88
description = "Short environment name (prd, dev)"
99
}
1010

11-
variable "service_name" {
12-
type = string
13-
description = "Name for AppRunner service and tags"
14-
}
15-
1611
variable "sqs_name_suffix" {
1712
type = string
1813
description = "Suffix for SQS queue names (prd, dev)"
@@ -23,11 +18,6 @@ variable "iam_role_prefix" {
2318
description = "PascalCase prefix for IAM role names (e.g., SponsorAppDev, SponsorApp)"
2419
}
2520

26-
variable "iam_apprunner_access_name" {
27-
type = string
28-
description = "Name for AppRunner ECR access IAM role"
29-
}
30-
3121
variable "enable_shared_resources" {
3222
type = bool
3323
description = "Enable shared resources (ECR, CloudWatch, EcsExec, GhaDeploy) - only true for prd"

0 commit comments

Comments
 (0)