-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Lambda와 CloudFront를 TF로 관리하도록 Migrate #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d2ae250
feat: Lambda의 소스 코드 생성
Hexeong 3cde4d0
refactor: app_stack 모듈에서 shared_resources로의 s3이동
Hexeong aa4342c
feat: global 환경에 대해서 shared_resources에 대한 variables 선언
Hexeong fccc099
feat: global 환경에 대해서 shared_resources에 대한 secret 추가
Hexeong 8dd2512
feat: global 환경에 대해서 shared_resources에 대한 provider 생성
Hexeong a15bba1
feat: lambda resource에 대한 정의
Hexeong 5add933
feat: cloudfront resource에 대한 정의
Hexeong 3a46f1c
feat: shared_resources 모듈을 사용해 global 환경 정의
Hexeong ee4f2f6
docs: readme update
Hexeong a0d1163
Merge remote-tracking branch 'origin/main' into feat/12-migrate-lambd…
Hexeong b26a513
chore: 변수 설명 부분을 맞게 수정
Hexeong 4bb4c78
refactor: CloudFront에 대해 ACM을 등록함으로써 TLSv1.2를 사용하도록 설정
Hexeong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule secrets
updated
from c1cf69 to 29cb90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| module "shared_resources" { | ||
| source = "../../modules/shared_resources" | ||
|
|
||
| providers = { | ||
| aws = aws | ||
| } | ||
|
|
||
| s3_default_bucket_name = var.s3_default_bucket_name | ||
| s3_upload_bucket_name = var.s3_upload_bucket_name | ||
|
|
||
| resizing_img_func_name = var.resizing_img_func_name | ||
| resizing_img_func_role = var.resizing_img_func_role | ||
| resizing_img_func_handler = var.resizing_img_func_handler | ||
| resizing_img_func_runtime = var.resizing_img_func_runtime | ||
| resizing_img_func_layers = var.resizing_img_func_layers | ||
|
|
||
| thumbnail_generating_func_name = var.thumbnail_generating_func_name | ||
| thumbnail_generating_func_role = var.thumbnail_generating_func_role | ||
| thumbnail_generating_func_handler = var.thumbnail_generating_func_handler | ||
| thumbnail_generating_func_runtime = var.thumbnail_generating_func_runtime | ||
| thumbnail_generating_func_layers = var.thumbnail_generating_func_layers | ||
|
|
||
| default_cdn_web_acl_id = var.default_cdn_web_acl_id | ||
| upload_cdn_web_acl_id = var.upload_cdn_web_acl_id | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| terraform { | ||
| required_version = ">= 1.0.0" | ||
|
|
||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = "~> 5.0" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "aws" { | ||
| region = "ap-northeast-2" | ||
|
|
||
| default_tags { | ||
| tags = { | ||
| Project = "solid-connection" | ||
| Environment = "global" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # [S3 버킷 관련 변수] | ||
| variable "s3_default_bucket_name" { | ||
| description = "Name of the default S3 bucket" | ||
| type = string | ||
| } | ||
|
|
||
| variable "s3_upload_bucket_name" { | ||
| description = "Name of the upload S3 bucket" | ||
| type = string | ||
| } | ||
|
|
||
| # [Lambda 관련 변수] | ||
| variable "resizing_img_func_name" { | ||
| description = "Image Resizing function name for uploaded s3 file" | ||
| type = string | ||
| } | ||
|
|
||
| variable "resizing_img_func_role" { | ||
| description = "Image Resizing function role for uploaded s3 file" | ||
| type = string | ||
| } | ||
|
|
||
| variable "resizing_img_func_handler" { | ||
| description = "Image Resizing function handler for uploaded s3 file" | ||
| type = string | ||
| } | ||
|
|
||
| variable "resizing_img_func_runtime" { | ||
| description = "Image Resizing function runtime for uploaded s3 file" | ||
| type = string | ||
| } | ||
|
|
||
| variable "thumbnail_generating_func_name" { | ||
| description = "Thumbnail generating function name for uploaded s3 file" | ||
| type = string | ||
| } | ||
|
|
||
| variable "thumbnail_generating_func_role" { | ||
| description = "Thumbnail generating function role for uploaded s3 file" | ||
| type = string | ||
| } | ||
|
|
||
| variable "thumbnail_generating_func_handler" { | ||
| description = "Thumbnail generating function handler for uploaded s3 file" | ||
| type = string | ||
| } | ||
|
|
||
| variable "thumbnail_generating_func_runtime" { | ||
| description = "Thumbnail generating function runtime for uploaded s3 file" | ||
| type = string | ||
| } | ||
|
|
||
| variable "resizing_img_func_layers" { | ||
| description = "Layers For Image Resizing func" | ||
| type = list(string) | ||
| } | ||
|
|
||
| variable "thumbnail_generating_func_layers" { | ||
| description = "Layers For Image Resizing func" | ||
| type = list(string) | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| variable "default_cdn_web_acl_id" { | ||
| description = "WAF Web ACL Id for Default Cloudfront CDN" | ||
| type = string | ||
| } | ||
|
|
||
| variable "upload_cdn_web_acl_id" { | ||
| description = "WAF Web ACL Id for Upload Cloudfront CDN" | ||
| type = string | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # 1. CDN for Default Bucket | ||
| resource "aws_cloudfront_distribution" "default_cdn" { | ||
| enabled = true | ||
| is_ipv6_enabled = true | ||
| comment = "solid-connection s3 default cloudfront" | ||
| price_class = "PriceClass_All" | ||
| http_version = "http2" | ||
|
|
||
| web_acl_id = var.default_cdn_web_acl_id | ||
|
|
||
| tags = { | ||
| "Name" = "solid-connection s3 default cloudfront" | ||
| } | ||
|
|
||
| origin { | ||
| domain_name = "${var.s3_default_bucket_name}.s3.ap-northeast-2.amazonaws.com" | ||
| origin_id = "${var.s3_default_bucket_name}.s3.ap-northeast-2.amazonaws.com-mjo1g7tk2w8" # 기존 ID 유지 | ||
| origin_access_control_id = "E14M8OP55A3YO7" | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| connection_attempts = 3 | ||
| connection_timeout = 10 | ||
| } | ||
|
|
||
| default_cache_behavior { | ||
| target_origin_id = "${var.s3_default_bucket_name}.s3.ap-northeast-2.amazonaws.com-mjo1g7tk2w8" # 위 origin_id와 같아야 함 | ||
| viewer_protocol_policy = "redirect-to-https" | ||
| compress = true | ||
|
|
||
| allowed_methods = ["GET", "HEAD"] | ||
| cached_methods = ["GET", "HEAD"] | ||
|
|
||
| cache_policy_id = "658327ea-f89d-4fab-a63d-7e88639e58f6" | ||
|
|
||
| smooth_streaming = false | ||
| } | ||
|
|
||
| restrictions { | ||
| geo_restriction { | ||
| restriction_type = "none" | ||
| locations = [] | ||
| } | ||
| } | ||
|
|
||
| viewer_certificate { | ||
| cloudfront_default_certificate = true | ||
| minimum_protocol_version = "TLSv1" | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| # 2. CDN for Upload Bucket | ||
| resource "aws_cloudfront_distribution" "upload_cdn" { | ||
| enabled = true | ||
| is_ipv6_enabled = true | ||
| comment = "solid-connection s3 upload cloudfront" | ||
| price_class = "PriceClass_All" | ||
| http_version = "http2" | ||
|
|
||
| web_acl_id = var.upload_cdn_web_acl_id | ||
|
|
||
| tags = { | ||
| "Name" = "solid-connection s3 upload cloudfront" | ||
| } | ||
|
|
||
| origin { | ||
| domain_name = "${var.s3_upload_bucket_name}.s3.ap-northeast-2.amazonaws.com" | ||
| origin_id = "${var.s3_upload_bucket_name}.s3.ap-northeast-2.amazonaws.com-mjo1jpx6rvc" | ||
| origin_access_control_id = "E1ZBB5RMSBZQ4I" | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| connection_attempts = 3 | ||
| connection_timeout = 10 | ||
| } | ||
|
|
||
| default_cache_behavior { | ||
| target_origin_id = "${var.s3_upload_bucket_name}.s3.ap-northeast-2.amazonaws.com-mjo1jpx6rvc" | ||
| viewer_protocol_policy = "redirect-to-https" | ||
| compress = true | ||
|
|
||
| allowed_methods = ["GET", "HEAD"] | ||
| cached_methods = ["GET", "HEAD"] | ||
|
|
||
| cache_policy_id = "658327ea-f89d-4fab-a63d-7e88639e58f6" | ||
|
|
||
| smooth_streaming = false | ||
| } | ||
|
|
||
| restrictions { | ||
| geo_restriction { | ||
| restriction_type = "none" | ||
| locations = [] | ||
| } | ||
| } | ||
|
|
||
| viewer_certificate { | ||
| cloudfront_default_certificate = true | ||
| minimum_protocol_version = "TLSv1" | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.