Skip to content

Commit

Permalink
Enable CORS for StorageV2 SKU and correct logic issue with validate_s…
Browse files Browse the repository at this point in the history
…tatic_website evaluation (#33)

* Adds primary and secondary blob hosts to output

Adds primary and secondary blob hosts to output from the storage account. These values are required downstream if you are setting up a cdn endpoint.

* Adds tags to the storage_account

Adds tags to the storage_account resource

* Trying to correct logic for enable_static_website flag

Trying to correct logic for enable_static_website flag. If enable_static_website = false, then validate_static_website should be allowed to evaluate to false instead of throwing an error

* Enable CORS policy application for StorageV2

Enable CORS policy application for StorageV2. Previously only BlockBlobStorage was allowed which conflicts with our need for RAGRS for CDN Storage Accounts

* Update main.tf

* Revert of access_list

Revert of access_list
  • Loading branch information
wilsonnm02 authored Sep 7, 2021
1 parent 3cb2d87 commit aa00afe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ locals {
account_tier = (var.account_tier == null ? (var.account_kind == "BlockBlobStorage" || var.account_kind == "FileStorage" ? "Premium" : "Standard") : var.account_tier)
static_website_enabled = (local.validate_static_website) ? [{}] : []

validate_static_website = ((var.enable_static_website && var.account_kind == "BlockBlobStorage" || var.account_kind == "StorageV2") ?
true : file("ERROR: Account kind must be BlockBlobStorage or StorageV2 when enabling static website"))
validate_static_website = ( var.enable_static_website ? ((var.account_kind == "BlockBlobStorage" || var.account_kind == "StorageV2") ?
true : file("ERROR: Account kind must be BlockBlobStorage or StorageV2 when enabling static website")) : false )

validate_nfsv3 = (!var.nfsv3_enabled || (var.nfsv3_enabled && var.enable_hns) ?
true : file("ERROR: NFS V3 can only be enabled when Hierarchical Namespaces are enabled"))
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resource "azurerm_storage_account" "sa" {
}

dynamic "blob_properties" {
for_each = (var.account_kind == "BlockBlobStorage" ? [1] : [])
for_each = ((var.account_kind == "BlockBlobStorage" || var.account_kind == "StorageV2") ? [1] : [])
content {
dynamic "delete_retention_policy" {
for_each = (var.blob_delete_retention_days == null ? [] : [1])
Expand Down

0 comments on commit aa00afe

Please sign in to comment.