Skip to content

Commit d994491

Browse files
authored
TF backend config file is not compliant with the canonical format when the S3 lockfile option is enabled (#193)
1 parent 7193646 commit d994491

File tree

3 files changed

+8
-28
lines changed

3 files changed

+8
-28
lines changed

main.tf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ locals {
1717
var.terraform_backend_config_file_name
1818
)
1919

20-
terraform_backend_default_template_file = local.s3_state_lock_enabled ? "${path.module}/templates/terraform-s3-lock.tf.tpl" : "${path.module}/templates/terraform.tf.tpl"
21-
terraform_version_minimum = local.s3_state_lock_enabled ? "1.11.0" : "1.0.0"
22-
terraform_version_requested = var.terraform_version != null ? var.terraform_version : local.terraform_version_minimum
23-
terraform_backend_config_template_file = var.terraform_backend_config_template_file != "" ? var.terraform_backend_config_template_file : local.terraform_backend_default_template_file
20+
terraform_version_minimum = local.s3_state_lock_enabled ? "1.11.0" : "1.0.0"
21+
terraform_version_requested = var.terraform_version != null ? var.terraform_version : local.terraform_version_minimum
22+
terraform_backend_config_template_file = var.terraform_backend_config_template_file != "" ? var.terraform_backend_config_template_file : "${path.module}/templates/terraform.tf.tpl"
2423

2524
terraform_backend_config_content = templatefile(local.terraform_backend_config_template_file, {
2625
region = data.aws_region.current.name

templates/terraform-s3-lock.tf.tpl

Lines changed: 0 additions & 24 deletions
This file was deleted.

templates/terraform.tf.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ terraform {
1313
role_arn = "${role_arn}"
1414
}
1515
%{~ endif ~}
16+
%{~ if use_lockfile ~}
17+
18+
use_lockfile = true
19+
%{~ else ~}
1620
%{~ if dynamodb_table != "" ~}
1721

1822
dynamodb_table = "${dynamodb_table}"
1923
%{~ endif ~}
24+
%{~ endif ~}
2025
}
2126
}

0 commit comments

Comments
 (0)