From 4156846396fd7c183ca398394d96217f55d193f2 Mon Sep 17 00:00:00 2001 From: Endre Karlson Date: Tue, 9 Feb 2021 23:24:49 +0100 Subject: [PATCH 1/2] Pin version to >=2.27 and remove provider decl --- versions.tf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/versions.tf b/versions.tf index e0fe656..077dec1 100644 --- a/versions.tf +++ b/versions.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 2.27.0" + version = ">= 2.27.0" } random = { source = "hashicorp/random" @@ -11,6 +11,3 @@ terraform { required_version = ">= 0.13" } -provider "azurerm" { - features {} -} From 6a9da58a2107b8b6e7a8022d68d1803966eb5b85 Mon Sep 17 00:00:00 2001 From: Endre Karlson Date: Tue, 9 Feb 2021 23:25:36 +0100 Subject: [PATCH 2/2] Resource should be count=0 if not enabled to avoid API problems --- main.tf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 3a594a9..9dcf808 100644 --- a/main.tf +++ b/main.tf @@ -25,7 +25,7 @@ resource "azurerm_resource_group" "rg" { } #--------------------------------------------------------- -# Storage Account Creation or selection +# Storage Account Creation or selection #---------------------------------------------------------- resource "random_string" "unique" { length = 6 @@ -66,9 +66,10 @@ resource "azurerm_storage_account" "storeacc" { } #-------------------------------------- -# Storage Advanced Threat Protection +# Storage Advanced Threat Protection #-------------------------------------- resource "azurerm_advanced_threat_protection" "atp" { + count = var.enable_advanced_threat_protection ? 1 : 0 target_resource_id = azurerm_storage_account.storeacc.id enabled = var.enable_advanced_threat_protection }