Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
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
}
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])
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
}
}
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
}

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)
}

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
}

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
}
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"
}
}
}