Skip to content

telekom-mms/terraform-azurerm-storage

Repository files navigation

storage

This module manages the hashicorp/azurerm storage resources. For more information see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs > storage

<-- This file is autogenerated, please do not change. -->

Requirements

Name Version
terraform >=1.5
azurerm >=3.103.0, <4.0

Providers

Name Version
azurerm >=3.103.0, <4.0

Resources

Name Type
azurerm_storage_account.storage_account resource
azurerm_storage_container.storage_container resource
azurerm_storage_management_policy.storage_management_policy resource
azurerm_storage_share.storage_share resource
azurerm_storage_share_directory.storage_share_directory resource

Inputs

Name Description Type Default Required
storage_account Resource definition, default settings are defined within locals and merged with var settings. For more information look at Outputs. any {} no
storage_container Resource definition, default settings are defined within locals and merged with var settings. For more information look at Outputs. any {} no
storage_management_policy Resource definition, default settings are defined within locals and merged with var settings. For more information look at Outputs. any {} no
storage_share Resource definition, default settings are defined within locals and merged with var settings. For more information look at Outputs. any {} no
storage_share_directory Resource definition, default settings are defined within locals and merged with var settings. For more information look at Outputs. any {} no

Outputs

Name Description
storage_account Outputs all attributes of resource_type.
storage_container Outputs all attributes of resource_type.
storage_management_policy Outputs all attributes of resource_type.
storage_share Outputs all attributes of resource_type.
storage_share_directory Outputs all attributes of resource_type.
variables Displays all configurable variables passed by the module. default = predefined values per module. merged = result of merging the default values and custom values passed to the module

Examples

Minimal configuration to install the desired resources with the module

module "storage" {
  source = "registry.terraform.io/telekom-mms/storage/azurerm"
  storage_account = {
    stmms = {
      location            = "westeurope"
      resource_group_name = "rg-mms-github"
    }
  }
  storage_management_policy = {
    policy = {
      storage_account_id = module.storage.storage_account.stmms.id
      rule = {
        rule1 = {
          filters = {
            blob_types = ["blockBlob"]
          }
          actions = {
            base_blob = {
              delete_after_days_since_modification_greater_than = 7
            }
          }
        }
      }
    }
  }
  storage_container = {
    terraform = {
      storage_account_name = module.storage.storage_account["stmms"].name
    }
  }
  storage_share = {
    share-mms = {
      storage_account_name = module.storage.storage_account["stmms"].name
      quota                = 5
    }
  }
  storage_share_directory = {
    files = {
      storage_account_name = module.storage.storage_account["stmms"].name
      share_name           = module.storage.storage_share["share-mms"].name
    }
  }
}

Advanced configuration to install the desired resources with the module

module "network" {
  source = "registry.terraform.io/telekom-mms/network/azurerm"
  virtual_network = {
    vn-app-mms = {
      location            = "westeurope"
      resource_group_name = "rg-mms-github"
      address_space       = ["173.0.0.0/23"]
    }
  }
  subnet = {
    snet-app-mms = {
      resource_group_name  = module.network.virtual_network["vn-app-mms"].resource_group_name
      address_prefixes     = ["173.0.0.0/23"]
      virtual_network_name = module.network.virtual_network["vn-app-mms"].name
      service_endpoints    = ["Microsoft.Storage"]
    }
  }
}

module "storage" {
  source = "registry.terraform.io/telekom-mms/storage/azurerm"
  storage_account = {
    stmms = {
      location            = "westeurope"
      resource_group_name = "rg-mms-github"
      network_rules = {
        ip_rules                   = ["172.0.0.2"]
        virtual_network_subnet_ids = [module.network.subnet["snet-app-mms"].id]
      }
      blob_properties = {
        last_access_time_enabled = true
      }
      tags = {
        project     = "mms-github"
        environment = terraform.workspace
        managed-by  = "terraform"
      }
    }
  }
  storage_management_policy = {
    policy = {
      storage_account_id = module.storage.storage_account.stmms.id
      rule = {
        rule1 = {
          filters = {
            blob_types   = ["blockBlob"]
            prefix_match = ["terraform"]
            match_blob_index_tag = {
              name      = "project"
              value     = "mms-github"
              operation = "=="
            }
          }
          actions = {
            base_blob = {
              tier_to_cool_after_days_since_last_access_time_greater_than = 7
              auto_tier_to_hot_from_cool_enabled                          = true
              tier_to_cold_after_days_since_modification_greater_than     = 30
            }
            snapshot = {
              tier_to_archive_after_days_since_last_tier_change_greater_than = 60
              delete_after_days_since_creation_greater_than                  = 180
            }
            version = {
              tier_to_cold_after_days_since_creation_greater_than = 30
              delete_after_days_since_creation                    = 90
            }
          }
        }
      }
    }
  }
  storage_container = {
    terraform = {
      storage_account_name = module.storage.storage_account["stmms"].name
    }
  }
  storage_share = {
    share-mms = {
      storage_account_name = module.storage.storage_account["stmms"].name
      quota                = 5
    }
  }
  storage_share_directory = {
    files = {
      storage_account_name = module.storage.storage_account["stmms"].name
      share_name           = module.storage.storage_share["share-mms"].name
    }
  }
}