-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
69 lines (58 loc) · 1.8 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
terraform {
required_version = ">= 1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
}
}
# sets the backend of tfstate files on Azure using below specs
backend "azurerm" {
resource_group_name = "tfstate"
storage_account_name = "storageaccounttfstate"
container_name = "tfstatecontainer"
key = "terraform.tfstate"
}
}
provider "azurerm" {
features {}
}
# Azure Resource Group Required for keeping tfstate backend resource together
resource "azurerm_resource_group" "tfstate" {
name = "tfstate"
location = "Central India"
}
# Storage Account keeps tfstate container
resource "azurerm_storage_account" "tfstate" {
name = "storageaccounttfstate"
resource_group_name = azurerm_resource_group.tfstate.name
location = azurerm_resource_group.tfstate.location
account_tier = "Standard"
account_replication_type = "LRS"
# allow_blob_public_access = false
tags = {
environment = "staging"
}
}
# Entity containing the tfstates.
resource "azurerm_storage_container" "tfstate" {
name = "tfstatecontainer"
storage_account_name = azurerm_storage_account.tfstate.name
container_access_type = "private"
}
# Consuming azure-app-service-docker module.
module "my_az_module" {
source = "./modules/azure-app-service-docker"
}
# Output variables
output "azure_container_registry" {
value = module.my_az_module.azure_container_registry
# sensitive = true
}
output "azure_container_registry_admin_username" {
value = module.my_az_module.azure_container_registry_admin_username
sensitive = true
}
output "azure_container_registry_admin_password" {
value = module.my_az_module.azure_container_registry_admin_password
sensitive = true
}