-
Notifications
You must be signed in to change notification settings - Fork 0
/
state.tf
53 lines (44 loc) · 1.11 KB
/
state.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
resource "aws_dynamodb_table" "terraform-lock" {
count = var.dynamodb_table == true ? 1 : 0
name = "TerraformMainStateLock"
read_capacity = 5
write_capacity = 5
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
tags = {
"Name" = "DynamoDB Terraform State Lock Table"
}
provider = aws.primary
}
resource "aws_s3_bucket" "bucket" {
count = var.bucket == true ? 1 : 0
bucket = "terraform-multi-account"
versioning {
enabled = true
}
tags = {
Name = "S3 Remote Terraform State Store"
}
provider = aws.primary
}
resource "aws_s3_bucket_server_side_encryption_configuration" "bucket" {
count = var.bucket == true ? 1 : 0
bucket = aws_s3_bucket.bucket[0].id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "aws:kms"
}
}
provider = aws.primary
}
resource "aws_s3_bucket_versioning" "bucket" {
count = var.bucket == true ? 1 : 0
bucket = aws_s3_bucket.bucket[0].id
versioning_configuration {
status = "Enabled"
}
provider = aws.primary
}