Skip to content

Commit

Permalink
Merge pull request #343 from recognizegroup/feature/TD-592_add_cors_r…
Browse files Browse the repository at this point in the history
…ules_to_storage_account_public

TD-592 - Add cors_rules to starage_account_public
  • Loading branch information
tom-reinders committed Jul 14, 2023
2 parents f4ed64b + c5f04d9 commit 2228e8a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Common Changelog](https://common-changelog.org),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.7.0] - 2023-07-14

### Added

- `azure/storage_account_public`: Add variable `cors_rules` ([#343](https://github.com/recognizegroup/terraform/pull/343)) ([`242a7de0`](https://github.com/recognizegroup/terraform/commit/242a7de0)) ([@tom-reinders](https://github.com/tom-reinders))

## [3.6.0] - 2023-07-13

### Added
Expand Down Expand Up @@ -153,6 +159,7 @@ _If you are upgrading: please see [UPGRADE_3.0.md](UPGRADE_3.0.md)._
- **Breaking:** Remove module `azure/monitoring`, replace with `azure/azure/monitoring_action_group` and `azure/monitoring_log_analytics_alert` ([#268](https://github.com/recognizegroup/terraform/pull/268)) ([`5bd013c1`](https://github.com/recognizegroup/terraform/commit/5bd013c1)) ([@pipalmic](https://github.com/pipalmic))
- **Breaking:** Remove module `azure/api_connectors/storage_account`, replace with `azure/api_connectors/storage_blob` and `azure/api_connectors/storage_table` ([#276](https://github.com/recognizegroup/terraform/pull/276)) ([`7a483886`](https://github.com/recognizegroup/terraform/commit/7a483886)) ([@pipalmic](https://github.com/pipalmic))

[3.7.0]: https://github.com/recognizegroup/terraform/releases/tag/v3.7.0
[3.6.0]: https://github.com/recognizegroup/terraform/releases/tag/v3.6.0
[3.5.0]: https://github.com/recognizegroup/terraform/releases/tag/v3.5.0
[3.4.0]: https://github.com/recognizegroup/terraform/releases/tag/v3.4.0
Expand Down
18 changes: 18 additions & 0 deletions modules/azure/storage_account_public/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ resource "azurerm_storage_account" "storage_account" {
nfsv3_enabled = var.nfsv3_enabled
is_hns_enabled = var.is_hns_enabled

dynamic "blob_properties" {
for_each = var.cors_rules != null ? [1] : []

content {
dynamic "cors_rule" {
for_each = var.cors_rules

content {
allowed_headers = cors_rule.value.allowed_headers
allowed_methods = cors_rule.value.allowed_methods
allowed_origins = cors_rule.value.allowed_origins
exposed_headers = cors_rule.value.exposed_headers
max_age_in_seconds = cors_rule.value.max_age_in_seconds
}
}
}
}

dynamic "network_rules" {
for_each = var.nfsv3_enabled == true ? [1] : []
content {
Expand Down
11 changes: 11 additions & 0 deletions modules/azure/storage_account_public/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,14 @@ variable "auto_delete_rules" {
default = null
}

variable "cors_rules" {
type = set(object({
allowed_headers = list(string),
allowed_methods = list(string),
allowed_origins = list(string),
exposed_headers = list(string),
max_age_in_seconds = number
}))
description = "Describes the CORS rules for the storage account"
default = null
}

0 comments on commit 2228e8a

Please sign in to comment.