File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ module "terraform_state" {
3737resource "aws_dynamodb_table" "terraform_state_lock" {
3838 # checkov:skip=CKV_AWS_28: The terraform state lock is meant to be ephemeral and does not need recovery
3939 # checkov:skip=CKV_AWS_119: The terraform state lock does not hold any sensitive data
40+ count = var. create_dynamodb_table ? 1 : 0
4041 name = var. dynamodb_table_name
4142 hash_key = " LockID"
4243 billing_mode = " PAY_PER_REQUEST"
Original file line number Diff line number Diff line change @@ -5,5 +5,5 @@ output "state_bucket" {
55
66output "dynamodb_table" {
77 description = " The name of the dynamo db table"
8- value = aws_dynamodb_table. terraform_state_lock . id
8+ value = var . create_dynamodb_table ? aws_dynamodb_table. terraform_state_lock [ 0 ] . id : null
99}
Original file line number Diff line number Diff line change @@ -41,3 +41,9 @@ variable "dynamodb_point_in_time_recovery" {
4141 default = false
4242 description = " Point-in-time recovery options"
4343}
44+
45+ variable "create_dynamodb_table" {
46+ type = bool
47+ default = true
48+ description = " Create DynamoDB table for Terraform state locking"
49+ }
You can’t perform that action at this time.
0 commit comments