Skip to content

Commit

Permalink
fix: add an optional redirect bucket variable for the redirect module (
Browse files Browse the repository at this point in the history
  • Loading branch information
kuannie1 authored Nov 19, 2024
1 parent 45f51ac commit 4e24726
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aws-cloudfront-domain-redirect/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ locals {
}

resource "aws_s3_bucket" "redirect_bucket" {
bucket = "redirect-${var.source_domain}-to-${var.target_domain}"
bucket = (var.redirect_bucket_name == null) : "redirect-${var.source_domain}-to-${var.target_domain}" ? var.redirect_bucket_name

website {
redirect_all_requests_to = "https://${var.target_domain}"
}
Expand Down
6 changes: 6 additions & 0 deletions aws-cloudfront-domain-redirect/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ variable "lambda_cloudwatch_log_retention_in_days" {
description = "Retention policy (in days) for Lambda function's logs in Cloudwatch"
default = null
}

variable "redirect_bucket_name" {
type = string
description = "Unique name for the redirect bucket (provide if possible)."
default = null
}

0 comments on commit 4e24726

Please sign in to comment.