Remove deprecated Amplify resources after CloudFront migration

- Comment out Amplify app, branches, and domain association
- Remove Amplify-related outputs
- Add migration notes for reference
- Amplify app deleted from AWS (dd6qls201bf9n)
This commit is contained in:
DaX
2025-10-31 02:07:14 +01:00
parent fc95dc4ed2
commit 1ce127c51c
2 changed files with 115 additions and 133 deletions

View File

@@ -20,117 +20,98 @@ provider "cloudflare" {
api_token = var.cloudflare_api_token != "" ? var.cloudflare_api_token : "dummy" # Dummy token if not provided api_token = var.cloudflare_api_token != "" ? var.cloudflare_api_token : "dummy" # Dummy token if not provided
} }
resource "aws_amplify_app" "filamenteka" { # ===== DEPRECATED: Amplify Hosting (Migrated to CloudFront + S3) =====
name = "filamenteka" # Amplify app was deleted due to broken GitHub integration
repository = var.github_repository # Frontend now hosted on CloudFront + S3 (see cloudfront-frontend.tf)
platform = "WEB" # Kept here for reference only
#
# GitHub access token for private repos (optional for public repos) # resource "aws_amplify_app" "filamenteka" {
# access_token = var.github_token # name = "filamenteka"
# repository = var.github_repository
# Build settings for Next.js # platform = "WEB"
build_spec = <<-EOT #
version: 1 # build_spec = <<-EOT
frontend: # version: 1
phases: # frontend:
preBuild: # phases:
commands: # preBuild:
- npm ci # commands:
- npm run security:check # - npm ci
build: # - npm run security:check
commands: # build:
- npm run build # commands:
- npm run test # - npm run build
artifacts: # - npm run test
baseDirectory: .next # artifacts:
files: # baseDirectory: .next
- '**/*' # files:
cache: # - '**/*'
paths: # cache:
- node_modules/**/* # paths:
- .next/cache/**/* # - node_modules/**/*
EOT # - .next/cache/**/*
# EOT
# Environment variables #
environment_variables = { # environment_variables = {
NEXT_PUBLIC_API_URL = "https://api.filamenteka.rs/api" # Using Cloudflare proxied subdomain # NEXT_PUBLIC_API_URL = "https://api.filamenteka.rs/api"
} # }
#
# Custom rules for single-page app # custom_rule {
custom_rule { # source = "/<*>"
source = "/<*>" # status = "404"
status = "404" # target = "/index.html"
target = "/index.html" # }
} #
# enable_branch_auto_build = true
# Enable branch auto build #
enable_branch_auto_build = true # tags = {
# Name = "Filamenteka"
tags = { # Environment = var.environment
Name = "Filamenteka" # "amplify:github_app_migration" = "opted_out"
Environment = var.environment # }
# Disable GitHub App migration prompt # }
"amplify:github_app_migration" = "opted_out" #
} # resource "aws_amplify_branch" "main" {
} # app_id = aws_amplify_app.filamenteka.id
# branch_name = "main"
# Main branch # enable_auto_build = true
resource "aws_amplify_branch" "main" { # environment_variables = {}
app_id = aws_amplify_app.filamenteka.id # stage = "PRODUCTION"
branch_name = "main" # tags = {
# Name = "Filamenteka-main"
# Enable auto build # Environment = var.environment
enable_auto_build = true # }
# }
# Environment variables specific to this branch (optional) #
environment_variables = {} # resource "aws_amplify_branch" "dev" {
# app_id = aws_amplify_app.filamenteka.id
stage = "PRODUCTION" # branch_name = "dev"
# enable_auto_build = true
tags = { # stage = "DEVELOPMENT"
Name = "Filamenteka-main" # tags = {
Environment = var.environment # Name = "Filamenteka-dev"
} # Environment = "development"
} # }
# }
# Development branch (optional) #
resource "aws_amplify_branch" "dev" { # resource "aws_amplify_domain_association" "filamenteka" {
app_id = aws_amplify_app.filamenteka.id # count = var.domain_name != "" ? 1 : 0
branch_name = "dev" # app_id = aws_amplify_app.filamenteka.id
# domain_name = var.domain_name
enable_auto_build = true # wait_for_verification = false
#
stage = "DEVELOPMENT" # sub_domain {
# branch_name = aws_amplify_branch.main.branch_name
tags = { # prefix = ""
Name = "Filamenteka-dev" # }
Environment = "development" #
} # sub_domain {
} # branch_name = aws_amplify_branch.main.branch_name
# prefix = "www"
# Custom domain (optional) # }
resource "aws_amplify_domain_association" "filamenteka" { #
count = var.domain_name != "" ? 1 : 0 # sub_domain {
# branch_name = aws_amplify_branch.dev.branch_name
app_id = aws_amplify_app.filamenteka.id # prefix = "dev"
domain_name = var.domain_name # }
wait_for_verification = false # }
# Map main branch to root domain
sub_domain {
branch_name = aws_amplify_branch.main.branch_name
prefix = ""
}
# Map main branch to www subdomain
sub_domain {
branch_name = aws_amplify_branch.main.branch_name
prefix = "www"
}
# Map dev branch to dev subdomain
sub_domain {
branch_name = aws_amplify_branch.dev.branch_name
prefix = "dev"
}
}

View File

@@ -1,22 +1,23 @@
output "app_id" { # ===== DEPRECATED: Amplify Outputs (removed after migration to CloudFront) =====
description = "The ID of the Amplify app" # output "app_id" {
value = aws_amplify_app.filamenteka.id # description = "The ID of the Amplify app"
} # value = aws_amplify_app.filamenteka.id
# }
output "app_url" { #
description = "The default URL of the Amplify app" # output "app_url" {
value = "https://main.${aws_amplify_app.filamenteka.default_domain}" # description = "The default URL of the Amplify app"
} # value = "https://main.${aws_amplify_app.filamenteka.default_domain}"
# }
output "dev_url" { #
description = "The development branch URL" # output "dev_url" {
value = "https://dev.${aws_amplify_app.filamenteka.default_domain}" # description = "The development branch URL"
} # value = "https://dev.${aws_amplify_app.filamenteka.default_domain}"
# }
output "custom_domain_url" { #
description = "The custom domain URL (if configured)" # output "custom_domain_url" {
value = var.domain_name != "" ? "https://${var.domain_name}" : "Not configured" # description = "The custom domain URL (if configured)"
} # value = var.domain_name != "" ? "https://${var.domain_name}" : "Not configured"
# }
output "rds_endpoint" { output "rds_endpoint" {
value = aws_db_instance.filamenteka.endpoint value = aws_db_instance.filamenteka.endpoint