From 9058aa123b2d5c5a246c4bdfd524d22d69ff9cff Mon Sep 17 00:00:00 2001 From: Salvador Montiel Date: Fri, 10 Nov 2023 15:42:59 -0600 Subject: [PATCH] fix: Better TF formating when dynamodb_table is empty when creating backend template file (#149) --- main.tf | 1 - templates/terraform.tf.tpl | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.tf b/main.tf index 7f86611..bf9bab2 100644 --- a/main.tf +++ b/main.tf @@ -60,7 +60,6 @@ data "aws_iam_policy_document" "aggregated_policy" { override_policy_documents = var.source_policy_documents } - data "aws_iam_policy_document" "bucket_policy" { count = local.enabled ? 1 : 0 diff --git a/templates/terraform.tf.tpl b/templates/terraform.tf.tpl index ee0e8fd..f313404 100644 --- a/templates/terraform.tf.tpl +++ b/templates/terraform.tf.tpl @@ -2,14 +2,15 @@ terraform { required_version = ">= ${terraform_version}" backend "s3" { - region = "${region}" - bucket = "${bucket}" - key = "${terraform_state_file}" + region = "${region}" + bucket = "${bucket}" + key = "${terraform_state_file}" + profile = "${profile}" + role_arn = "${role_arn}" + encrypt = "${encrypt}" + %{~ if dynamodb_table != "" ~} dynamodb_table = "${dynamodb_table}" %{~ endif ~} - profile = "${profile}" - role_arn = "${role_arn}" - encrypt = "${encrypt}" } }