Skip to content

Commit dfdc467

Browse files
authored
Change storage account data resource to a resource that creates a storage account (#42)
1 parent c023947 commit dfdc467

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

terraform/deployments/with-diagnostic-setting-logging/main.tf

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ module "prerequisites" {
1919
tags = var.tags
2020
}
2121

22-
data "azurerm_storage_account" "example" {
23-
name = var.storage_account_name
24-
resource_group_name = var.storage_account_resource_group
22+
resource "azurerm_storage_account" "example" {
23+
name = var.storage_account_name
24+
resource_group_name = module.prerequisites.resource_group_name
25+
location = var.location
26+
account_tier = "Standard"
27+
account_replication_type = "GRS"
28+
29+
tags = var.tags
2530
}
2631

2732
resource "azurerm_nginx_deployment" "example" {
@@ -83,7 +88,7 @@ EOT
8388
resource "azurerm_monitor_diagnostic_setting" "example" {
8489
name = "${azurerm_nginx_deployment.example.name}-logs"
8590
target_resource_id = azurerm_nginx_deployment.example.id
86-
storage_account_id = data.azurerm_storage_account.example.id
91+
storage_account_id = azurerm_storage_account.example.id
8792

8893
enabled_log {
8994
category = "NginxLogs"

terraform/deployments/with-diagnostic-setting-logging/variables.tf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ variable "name" {
1010

1111
variable "storage_account_name" {
1212
description = "Name of the storage account to store NGINX logs."
13-
}
14-
15-
variable "storage_account_resource_group" {
16-
description = "Resource group that contains the storage account to store NGINX logs."
13+
default = "examplenginxstorageacct"
1714
}
1815

1916
variable "sku" {

0 commit comments

Comments
 (0)