Skip to content

dsb-norge/terraform-azurerm-terraform-state-container

Repository files navigation

Terraform module for creation of Terraform remote state container in Azure

Terraform module to create storage account with container to store Terraform state remotely in azure. Module has following features:

  • Create resource group for storage account.
  • Create storage account with private container for state.
  • Create Delete lock on resources.
  • Create network rules for storage account.
  • Tag resources with createBy and costCenter tags.

Usage

Refer to examples for usage of module.

Requirements

Name Version
terraform ~> 1.0
azurerm >= 3.0.0, < 5.0.0

Resources

Name Type
azurerm_resource_group.tfstate resource
azurerm_storage_account.tfstate resource
azurerm_storage_account_network_rules.tfstate resource
azurerm_storage_container.tfstate resource

Inputs

Name Description Type Default Required
application_friendly_description Friendly description of the application to use when naming resources. string n/a yes
application_name Name of the application to use when naming resources. string n/a yes
application_name_short Short name of the application to use when naming resources eg. for storage account name. string n/a yes
created_by_tag The value of createdBy Tag string n/a yes
environment_name Name of the environment to use when naming resources. string n/a yes
subscription_number Subscription number to use when naming resources. number n/a yes
azure_region Name of the Azure region to use when naming resources. string "norwayeast" no
costcenter_tag_value The value of the costCenter tag.
This is DSB mandatory tag identifying resource group cost center affiliation.
Default value is set to DSB IKT cost center.
string "142" no
network_rules Network rules to apply to the terraform backend state storage account.
object({
default_action = string
bypass = list(string)
ip_rules = list(string)
virtual_network_subnet_ids = list(string)
})
{
"bypass": null,
"default_action": "Deny",
"ip_rules": [
"91.229.21.0/24"
],
"virtual_network_subnet_ids": null
}
no
state_container_name Name of the state container to use when naming resources. string "terraform-remote-backend-state" no

Outputs

Name Description
container_id The ID of the storage container created for terraform backend state.
container_name Name of the storage container created for terraform backend state.
container_resource_manager_id The Resource Manager ID of the storage container created for terraform backend state.
resource_group_name Name of the resource group created for terraform backend state.
storage_account_name Name of the storage account created for terraform backend state.

Modules

No modules.