-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
49 lines (42 loc) · 1.1 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
terraform {
backend "s3" {
bucket = "state.charemza.name"
key = "projections.charemza.name.tfstate"
region = "eu-west-2"
}
}
provider "aws" {
region = "eu-west-2"
}
data "aws_route53_zone" "charemza_name" {
name = "charemza.name."
}
resource "aws_s3_bucket" "projections_charemza_name" {
bucket = "projections.charemza.name"
policy = "${data.aws_iam_policy_document.projections_charemza_name.json}"
website {
index_document = "index.html"
error_document = "error.html"
}
}
data "aws_iam_policy_document" "projections_charemza_name" {
statement {
effect = "Allow"
principals {
type = "AWS"
identifiers = ["*"]
}
actions = ["s3:GetObject"]
resources = ["arn:aws:s3:::projections.charemza.name/*"]
}
}
resource "aws_route53_record" "projections_charemza_name" {
zone_id = "${data.aws_route53_zone.charemza_name.zone_id}"
name = "projections.charemza.name"
type = "A"
alias {
name = "s3-website.eu-west-2.amazonaws.com"
zone_id = "${aws_s3_bucket.projections_charemza_name.hosted_zone_id}"
evaluate_target_health = false
}
}