forked from KanoComputing/tapcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
110 lines (110 loc) · 3.81 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{
"variable": {
"domain_name": {
"default": "tapcode",
"description": "production environment for the tapcode domain name"
}
},
"terraform": {
"backend": {
"s3": {
"bucket": "terraform.kano",
"key": "tapcode/terraform.tfstate",
"region": "eu-west-1"
}
}
},
"provider": {
"aws": {
"region": "us-west-1"
}
},
"resource": {
"aws_s3_bucket": {
"main": {
"bucket": "${var.domain_name}.kano.me",
"force_destroy": true,
"acl": "public-read",
"policy": "${file(\"policy.json\")}",
"cors_rule": {
"allowed_headers": ["*"],
"allowed_methods": ["GET"],
"allowed_origins": ["https://*.kano.me", "http://localhost:*", "http://127.0.0.1:*"],
"expose_headers": ["ETag"],
"max_age_seconds": 86400
},
"website": {
"index_document": "index.html",
"error_document": "index.html"
}
}
},
"aws_cloudfront_distribution": {
"main": {
"origin": {
"domain_name": "${aws_s3_bucket.main.bucket_domain_name}",
"origin_id": "${var.domain_name}"
},
"aliases": ["${aws_s3_bucket.main.bucket}"],
"enabled": true,
"is_ipv6_enabled": true,
"comment": "${var.domain_name} edge caching",
"default_root_object": "index.html",
"default_cache_behavior": {
"compress": true,
"allowed_methods": ["HEAD", "GET", "OPTIONS"],
"cached_methods": ["HEAD", "GET", "OPTIONS"],
"target_origin_id": "${var.domain_name}",
"viewer_protocol_policy": "redirect-to-https",
"min_ttl": 0,
"default_ttl": 3600,
"max_ttl": 86400,
"forwarded_values": {
"query_string": false,
"cookies": {
"forward": "none"
},
"headers": ["Origin", "Access-Control-Request-Headers", "Access-Control-Request-Method"]
}
},
"viewer_certificate": {
"iam_certificate_id": "ASCAJXMICN5PIG23H7L76",
"ssl_support_method": "sni-only",
"minimum_protocol_version": "TLSv1"
},
"restrictions": {
"geo_restriction": {
"restriction_type": "none"
}
},
"custom_error_response": {
"error_caching_min_ttl": 5,
"error_code": 404,
"response_code": 200,
"response_page_path": "/index.html"
}
}
},
"aws_route53_record": {
"main": {
"zone_id": "Z3CJAAJCKXZI0S",
"name": "${var.domain_name}",
"type": "CNAME",
"ttl": 300,
"records": ["${aws_cloudfront_distribution.main.domain_name}"]
}
},
"aws_dynamodb_table": {
"basic-dynamodb-table": {
"name": "tapcode",
"read_capacity": 5,
"write_capacity": 5,
"hash_key": "id",
"attribute": {
"name": "id",
"type": "S"
}
}
}
}
}