File tree 2 files changed +43
-0
lines changed
2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ data "aws_route53_zone" "this" {
2
+ name = var. route53_domain
3
+ }
4
+
5
+ resource "aws_s3_bucket" "this" {
6
+ bucket = " ${ var . subdomain } .${ data . aws_route53_zone . this . name } "
7
+ }
8
+
9
+ locals {
10
+ redirect_split = split (" ://" , var. redirect_url )
11
+ }
12
+
13
+ resource "aws_s3_bucket_website_configuration" "this" {
14
+ bucket = aws_s3_bucket. this . id
15
+
16
+ redirect_all_requests_to {
17
+ protocol = local. redirect_split [0 ]
18
+ host_name = local. redirect_split [1 ]
19
+ }
20
+ }
21
+
22
+ resource "aws_route53_record" "this" {
23
+ zone_id = data. aws_route53_zone . this . id
24
+ name = " ${ var . subdomain } .${ data . aws_route53_zone . this . name } "
25
+ type = " A"
26
+
27
+ alias {
28
+ name = aws_s3_bucket_website_configuration. this . website_domain
29
+ zone_id = aws_s3_bucket. this . hosted_zone_id
30
+ evaluate_target_health = true
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ variable "route53_domain" {
2
+ type = string
3
+ }
4
+
5
+ variable "subdomain" {
6
+ type = string
7
+ }
8
+
9
+ variable "redirect_url" {
10
+ type = string
11
+ }
You can’t perform that action at this time.
0 commit comments