Skip to content

Commit

Permalink
Merge pull request #10 from domroutley/variablise
Browse files Browse the repository at this point in the history
Variablise
  • Loading branch information
domroutley authored Dec 19, 2020
2 parents bf8055e + a06d019 commit f19a49f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "azurerm_resource_group" "web_rg" {
name = "website-rg"
name = var.resource_group_name
location = var.location
}

Expand All @@ -9,7 +9,7 @@ resource "azurerm_storage_account" "web_sa" {
location = var.location
account_kind = "StorageV2"
account_tier = "Standard"
account_replication_type = "GRS"
account_replication_type = var.sa_replication_type
allow_blob_public_access = true
enable_https_traffic_only = false

Expand Down
25 changes: 21 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
variable "endpoint" {
description = "CDN endpoint name (XX.azureedge.net)"
}

variable "storage_account_name" {
description = "The name of the storage account, must be globaly unique."
}

variable "location" {
default = "UK South"
description = "Location for the resource group and storage account."
Expand All @@ -8,10 +16,19 @@ variable "cdn_location" {
description = "Location for the CDN profile and endpoint."
}

variable "endpoint" {
description = "CDN endpoint name (XX.azureedge.net)"
variable "sa_replication_type" {
description = "The storage account replication type. Valid values are: LRS, ZRS, GRS, RA-GRS"
default = "LRS"
validation {
condition = contains(
["LRS", "ZRS", "GRS", "RA-GRS"],
var.sa_replication_type
)
error_message = "Variable sa_replication_type must be one of: LRS, ZRS, GRS, RA-GRS."
}
}

variable "storage_account_name" {
description = "The name of the storage account, must be globaly unique"
variable "resource_group_name" {
description = "The name of the resource group to store all resources in."
default = "website-rg"
}

0 comments on commit f19a49f

Please sign in to comment.