-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend.tf
32 lines (27 loc) · 893 Bytes
/
backend.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
// More backend options:
// https://developer.hashicorp.com/terraform/language/settings/backends/configuration
// Create S3 bucket for storing the state
resource "aws_s3_bucket" "terraform_state" {
bucket = var.s3_backend_bucket
force_destroy = true
tags = {
ProjectTag = var.project_tag
}
}
// Create DynamoDB table for state locking
resource "aws_dynamodb_table" "terraform_state_lock" {
name = var.s3_backend_dynamodb_table
read_capacity = var.dynamodb_table_provisioned_rcu
write_capacity = var.dynamodb_table_provisioned_wcu
# deletion_protection_enabled = true
// The table must have a partition key named LockID with type of String.
// If not configured, state locking will be disabled.
hash_key = "LockID"
attribute {
name = "LockID"
type = "S" // S (string), N (number), B (binary)
}
tags = {
ProjectTag = var.project_tag
}
}