-
Notifications
You must be signed in to change notification settings - Fork 19
Add module for Storage account static website hosted on CDN Frontdoor #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
modules/azurerm/Storage-Account-Static-Website-CDN-FrontDoor/cdn_frontdoor.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # ------------------------------------------------------------------------------------- | ||
| # | ||
| # Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. | ||
| # | ||
| # WSO2 LLC. licenses this file to you under the Apache License, | ||
| # Version 2.0 (the "License"); you may not use this file except | ||
| # in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| # -------------------------------------------------------------------------------------- | ||
|
|
||
| resource "azurerm_cdn_frontdoor_profile" "cdn_frontdoor_profile" { | ||
| name = join("-", [var.cdn_frontdoor_profile_abbreviation, var.cdn_frontdoor_profile_name]) | ||
| resource_group_name = var.resource_group_name | ||
| sku_name = var.cdn_frontdoor_profile_sku_name | ||
| response_timeout_seconds = var.response_timeout_seconds | ||
| tags = var.tags | ||
| } | ||
|
|
||
| resource "azurerm_cdn_frontdoor_endpoint" "cdn_frontdoor_endpoint" { | ||
| name = join("-", [var.cdn_frontdoor_endpoint_abbreviation, var.cdn_frontdoor_endpoint_name]) | ||
| cdn_frontdoor_profile_id = azurerm_cdn_frontdoor_profile.cdn_frontdoor_profile.id | ||
| enabled = var.cdn_frontdoor_endpoint_enabled | ||
| tags = var.tags | ||
| } | ||
SazniMohamed marked this conversation as resolved.
Show resolved
Hide resolved
SazniMohamed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
64 changes: 64 additions & 0 deletions
64
modules/azurerm/Storage-Account-Static-Website-CDN-FrontDoor/outputs.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # ------------------------------------------------------------------------------------- | ||
| # | ||
| # Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. | ||
| # | ||
| # WSO2 LLC. licenses this file to you under the Apache License, | ||
| # Version 2.0 (the "License"); you may not use this file except | ||
| # in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| # -------------------------------------------------------------------------------------- | ||
|
|
||
| output "storage_account_name" { | ||
| depends_on = [azurerm_storage_account.static_storage] | ||
| value = azurerm_storage_account.static_storage.name | ||
| } | ||
|
|
||
| output "storage_account_id" { | ||
| depends_on = [azurerm_storage_account.static_storage] | ||
| value = azurerm_storage_account.static_storage.id | ||
| } | ||
|
|
||
| output "storage_account_primary_web_endpoint" { | ||
| depends_on = [azurerm_storage_account.static_storage] | ||
| value = azurerm_storage_account.static_storage.primary_web_endpoint | ||
| } | ||
|
|
||
| output "storage_account_primary_web_host" { | ||
| depends_on = [azurerm_storage_account.static_storage] | ||
| value = azurerm_storage_account.static_storage.primary_web_host | ||
| } | ||
|
|
||
| output "storage_account_secondary_web_endpoint" { | ||
| depends_on = [azurerm_storage_account.static_storage] | ||
| value = azurerm_storage_account.static_storage.secondary_web_endpoint | ||
| } | ||
|
|
||
| output "cdn_frontdoor_profile_name" { | ||
| depends_on = [azurerm_cdn_frontdoor_profile.cdn_frontdoor_profile] | ||
| value = azurerm_cdn_frontdoor_profile.cdn_frontdoor_profile.name | ||
| } | ||
|
|
||
| output "cdn_frontdoor_profile_id" { | ||
| depends_on = [azurerm_cdn_frontdoor_profile.cdn_frontdoor_profile] | ||
| value = azurerm_cdn_frontdoor_profile.cdn_frontdoor_profile.id | ||
| } | ||
|
|
||
| output "cdn_frontdoor_endpoint_hostname" { | ||
| depends_on = [azurerm_cdn_frontdoor_endpoint.cdn_frontdoor_endpoint] | ||
| value = azurerm_cdn_frontdoor_endpoint.cdn_frontdoor_endpoint.host_name | ||
| } | ||
|
|
||
| output "cdn_frontdoor_endpoint_id" { | ||
| depends_on = [azurerm_cdn_frontdoor_endpoint.cdn_frontdoor_endpoint] | ||
| value = azurerm_cdn_frontdoor_endpoint.cdn_frontdoor_endpoint.id | ||
| } |
54 changes: 54 additions & 0 deletions
54
...es/azurerm/Storage-Account-Static-Website-CDN-FrontDoor/storage_account_static_website.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # ------------------------------------------------------------------------------------- | ||
| # | ||
| # Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. | ||
| # | ||
| # WSO2 LLC. licenses this file to you under the Apache License, | ||
| # Version 2.0 (the "License"); you may not use this file except | ||
| # in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| # -------------------------------------------------------------------------------------- | ||
|
|
||
| resource "azurerm_storage_account" "static_storage" { | ||
| name = join("", ["st", var.storage_account_name]) | ||
SazniMohamed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| resource_group_name = var.resource_group_name | ||
| location = var.location | ||
| account_kind = "StorageV2" | ||
| account_tier = var.account_tier | ||
| account_replication_type = var.account_replication_type | ||
| min_tls_version = "TLS1_2" | ||
| https_traffic_only_enabled = true | ||
| allow_nested_items_to_be_public = var.allow_nested_items_to_be_public | ||
| cross_tenant_replication_enabled = var.cross_tenant_replication_enabled | ||
| tags = var.tags | ||
|
|
||
| blob_properties { | ||
| delete_retention_policy { | ||
| days = 7 | ||
| } | ||
| } | ||
|
|
||
| dynamic "network_rules" { | ||
| for_each = var.network_rules_enabled ? [1] : [] | ||
| content { | ||
| default_action = var.network_rules_default_action | ||
| ip_rules = var.network_rules_ip_whitelist | ||
| virtual_network_subnet_ids = var.network_rules_subnet_ids | ||
| bypass = var.network_rules_bypass | ||
| } | ||
| } | ||
|
|
||
| static_website { | ||
| index_document = var.index_document | ||
| error_404_document = var.error_document | ||
| } | ||
| } | ||
140 changes: 140 additions & 0 deletions
140
modules/azurerm/Storage-Account-Static-Website-CDN-FrontDoor/variables.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| # ------------------------------------------------------------------------------------- | ||
| # | ||
| # Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. | ||
| # | ||
| # WSO2 LLC. licenses this file to you under the Apache License, | ||
| # Version 2.0 (the "License"); you may not use this file except | ||
| # in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| # -------------------------------------------------------------------------------------- | ||
|
|
||
| variable "storage_account_name" { | ||
| description = "Name of the storage account" | ||
| type = string | ||
| } | ||
|
|
||
| variable "resource_group_name" { | ||
| description = "Name of the resource group" | ||
| type = string | ||
| } | ||
SazniMohamed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| variable "account_tier" { | ||
| description = "Defines the Tier to use for this storage account" | ||
| type = string | ||
| } | ||
|
|
||
| variable "account_replication_type" { | ||
| description = "Defines the type of replication to use for this storage account" | ||
| type = string | ||
| } | ||
|
|
||
| variable "tags" { | ||
| description = "Tags to be used in resources" | ||
| type = map(string) | ||
| } | ||
|
|
||
| variable "index_document" { | ||
| description = "The name of the index document." | ||
| type = string | ||
| } | ||
|
|
||
| variable "error_document" { | ||
| description = "The name of the error document." | ||
| type = string | ||
| } | ||
|
|
||
| variable "network_rules_ip_whitelist" { | ||
| default = [] | ||
| description = "List of IP addresses or ranges to whitelist for storage account via firewall. Defaults to []" | ||
| type = list(string) | ||
| } | ||
|
|
||
| variable "network_rules_default_action" { | ||
| default = "Deny" | ||
| description = "The default action of allow or deny when no other rules match" | ||
| type = string | ||
| } | ||
|
|
||
| variable "network_rules_subnet_ids" { | ||
| default = [] | ||
| description = "List of subnet IDs to whitelist for storage account via firewall. Defaults to []" | ||
| type = list(string) | ||
| } | ||
|
|
||
| variable "allow_nested_items_to_be_public" { | ||
| default = false | ||
| description = "Allow or disallow nested items within this Account to opt into being public" | ||
| type = bool | ||
| } | ||
|
|
||
| variable "network_rules_bypass" { | ||
| default = ["AzureServices"] | ||
| description = "List of actions that bypass the network rule." | ||
| type = list(string) | ||
| } | ||
SazniMohamed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| variable "cdn_frontdoor_profile_name" { | ||
| description = "Name of the CDN Frontdoor profile" | ||
| type = string | ||
| } | ||
|
|
||
| variable "cdn_frontdoor_profile_sku_name" { | ||
| description = "The pricing tier of the CDN Frontdoor profile" | ||
| type = string | ||
| } | ||
|
|
||
| variable "cdn_frontdoor_endpoint_name" { | ||
| description = "Name of the CDN endpoint" | ||
| type = string | ||
| } | ||
|
|
||
| variable "cross_tenant_replication_enabled" { | ||
| default = false | ||
| description = "Enable or disable cross tenant replication" | ||
| type = bool | ||
| } | ||
|
|
||
| variable "network_rules_enabled" { | ||
| default = true | ||
| description = "Enable or disable network rules for the storage account" | ||
| type = bool | ||
| } | ||
|
|
||
| variable "response_timeout_seconds" { | ||
| description = "The response timeout for the Front Door Profile." | ||
| type = number | ||
| default = 30 | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| variable "cdn_frontdoor_profile_abbreviation" { | ||
| description = "Abbreviation for CDN Frontdoor Profile" | ||
| type = string | ||
| default = "cdnp" | ||
| } | ||
|
|
||
| variable "cdn_frontdoor_endpoint_abbreviation" { | ||
| description = "Abbreviation for CDN Frontdoor Endpoint" | ||
| type = string | ||
| default = "cdne" | ||
| } | ||
|
|
||
| variable "cdn_frontdoor_endpoint_enabled" { | ||
| description = "CDN Frontdoor Endpoint Enabled or Not" | ||
| type = bool | ||
| default = true | ||
| } | ||
|
|
||
| variable "location" { | ||
| description = "Azure region" | ||
| type = string | ||
| } | ||
29 changes: 29 additions & 0 deletions
29
modules/azurerm/Storage-Account-Static-Website-CDN-FrontDoor/versions.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # ------------------------------------------------------------------------------------- | ||
| # | ||
| # Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. | ||
| # | ||
| # WSO2 LLC. licenses this file to you under the Apache License, | ||
| # Version 2.0 (the "License"); you may not use this file except | ||
| # in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| # -------------------------------------------------------------------------------------- | ||
|
|
||
| terraform { | ||
| required_version = ">= 0.13" | ||
| required_providers { | ||
| azurerm = { | ||
| source = "hashicorp/azurerm" | ||
| version = ">= 4.0.0" | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.