storage-account/

directory
v0.0.0-...-5957262 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2022 License: Apache-2.0

README

Azure Storage

This Terraform based storage-account module grants templates the ability to configure and deploy cloud storage containers along with a storage account using Microsoft's Azure Storage service.

In addition, this module offers both authentication and authorization features:

  • For authentication, this module automatically enrolls the deployed storage account into Microsoft's Managed Identities service.
What is Azure Storage?

From the official Documentation:

"A storage account provides a unique namespace in Azure for your data. Every object that you store in Azure Storage has an address that includes your unique account name. A container organizes a set of blobs, similar to a directory in a file system. A storage account can include an unlimited number of containers, and a container can store an unlimited number of blobs." - Source: Microsoft's Introduction to Azure Blob Storage

This module deploys a storage account along with storage containers in order to satisfy blob storage scenarios which are optimized for storing massive amounts of unstructured data, such as text or binary data.

Current Features

An instance of the storage-account module deploys the Azure Storage service in order to provide templates with the following:

  • Ability to deploy Storage Containers alongside deploying a Storage Account.

Module Usage

Azure Storage usage example:

resource "azurerm_resource_group" "sample" {
  name     = var.prefix
  location = var.resource_group_location
}

module "storage_account" {
  source              = "../../modules/providers/azure/storage-account"

  name                = "mystorageaccount"
  container_names     = ["test"]
  share_names         = ["share"]
  queue_names         = ["queue"]
  resource_group_name = azurerm_resource_group.sample.name
}
Resources
Resource Terraform Link Description
azurerm_storage_account storage account This resource will be declared within the module.
azurerm_storage_container storage container This resource will be declared within the module.
azurerm_storage_share storage share This resource will be declared within the module.
azurerm_storage_queue storage queue This resource will be declared within the module.
Input Variables

Please refer to variables.tf.

Output Variables

Please refer to output.tf.

Automated Tests

Setup the Environment.

# Copy the environment template and populate required values for RESOURCE_GROUP_NAME STORAGE_ACCOUNT_NAME and CONTAINER_NAME in .env
cp ./tests/.env.testing.template .env

# Export the environment variables.
export $(cat .env | xargs)

# Create a resource group if one does not exist.  (OPTIONAL)
az group create --name $RESOURCE_GROUP_NAME --location eastus2

## Create a tfvars file from the environment values.
cat > testing.tfvars << EOF
name = "$STORAGE_ACCOUNT_NAME"

container_names = [
  "$CONTAINER_NAME"
]

resource_group_name = "$RESOURCE_GROUP_NAME"
EOF

This module's tests validate a provisioned Terraform workspace.

terraform init
terraform plan --var-file=testing.tfvars
terraform apply --var-file=testing.tfvars

Execute Unit Tests

go test -v $(go list ./... | grep "unit")

Execute Integration Tests

go test -v $(go list ./... | grep "integration")

License

Copyright © Microsoft Corporation

Licensed 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL