forked from krishcool/test1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage with container and state file
49 lines (43 loc) · 1.21 KB
/
storage with container and state file
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Set the Azure Provider source and version being used
terraform {
required_version = ">= 0.14"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.1.0"
}
}
}
# Configure the Microsoft Azure provider
provider "azurerm" {
features {}
}
terraform {
backend "azurerm" {
resource_group_name = "rgteswesteu001"
storage_account_name = "strgtestwesteu001"
container_name = "conttesywesteu001"
key = "terraform.tfstate"
}
}
# use the existing Resource Group
data "azurerm_resource_group" "resourcegroup" {
name = "rgteswesteu001"
}
# Create a Storage account
resource "azurerm_storage_account" "terraform_state" {
name = "sttestwesteu008"
resource_group_name = "rgteswesteu001"
location = "West Europe"
account_tier = "Standard"
account_replication_type = "LRS"
tags = {
environment = "my-terraform-env"
}
}
# Create a Storage container
resource "azurerm_storage_container" "terraform_state" {
name = "conttestwesteu008"
storage_account_name = azurerm_storage_account.terraform_state.name
container_access_type = "private"
}