-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.tf
35 lines (31 loc) · 1.1 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
locals {
default_tags = {
scope = "Terraform"
}
all_tags = merge(local.default_tags, var.tags)
}
resource "azurerm_resource_group" "rg" {
name = var.resource_group_name
location = var.location
tags = local.all_tags
}
resource "azurerm_management_lock" "rg_lock" {
name = "${var.resource_group_name}-lock"
count = var.create_lock ? 1 : 0
scope = azurerm_resource_group.rg.id
lock_level = "CanNotDelete"
}
resource "azurerm_storage_account" "sa_tf_state" {
name = var.storage_account_name
resource_group_name = azurerm_resource_group.rg.name
location = var.location
account_tier = var.storage_account_tier
account_replication_type = var.storage_account_replication_type
access_tier = var.storage_account_access_tier
tags = local.all_tags
}
resource "azurerm_storage_container" "sc_tf_state" {
name = var.storage_container_name
storage_account_name = azurerm_storage_account.sa_tf_state.name
container_access_type = var.storage_container_access_type
}