-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.tfgen
44 lines (38 loc) · 926 Bytes
/
example.tfgen
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
terraform {
backend "s3" {
bucket = "terraform-state-[accountID]-[region]"
key = "[app].tfstate"
region = "[region]"
profile = "[profile]"
dynamodb_table = "terraform-state-lock-[accountID]-[region]"
}
}
locals {
profile = "[profile]"
region = "[region]"
bucket_name = "[app]-[accountID]-[profile]-[region]"
}
provider "aws" {
profile = "${local.profile}"
region = "${local.region}"
version = "~> 2.12"
}
resource "aws_s3_bucket" "b" {
bucket = "${local.bucket_name}"
acl = "private"
versioning {
enabled = true
}
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
}
resource "aws_s3_bucket_public_access_block" "b" {
bucket = "${aws_s3_bucket.b.id}"
block_public_acls = true
block_public_policy = true
}