-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.tf
56 lines (45 loc) · 1.32 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Terraform configuration
# Terraform configuration
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "4.0.0"
}
}
}
provider "aws" {
region = "ap-southeast-2"
}
module "website_s3_bucket" {
source = "./terraform/modules/aws-s3-static-website-bucket"
bucketname = var.bucket_name
app_env=var.app_env
bucketarn=module.website_s3_bucket.arn
oai_iam_arn=module.website_CDN.cloudfrontarn
}
module "website_CDN" {
source = "./terraform/modules/CDN"
CDN_domain_name = module.website_s3_bucket.domain
bucketname = var.bucket_name
app_env=var.app_env
//acm_certificate_arn=module.ACM.ACM_arn
}
module "DNS" {
source = "./terraform/modules/DNS record"
cdndomain = module.website_CDN.cloudfrontdomain
hosted_zone_id=module.website_CDN.cloudfronthosted_zone_id
url= "www.sortlog.net" //var.frontendurl
}
####To configure Terraform to store the state in your S3 bucket (with encryption and locking), you need to add a backend configuration to your Terraform code.
terraform {
backend "s3" {
# Replace this with your bucket name!
bucket = "sortlog-tfstate-s3"
key = "terraform.tfstate"
region = "ap-southeast-2"
# Replace this with your DynamoDB table name!
dynamodb_table = "DBlock-sortlog"
encrypt = true
}
}