-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
formatter: markdown document | ||
output: | ||
file: "README.md" | ||
settings: | ||
anchor: false |
This file contains 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,90 @@ | ||
# Terraform state management (for Azure) | ||
|
||
## Introduction | ||
|
||
This module manages storage for Terraform states and is usually used in the Terraform "state" module as a base | ||
for other modules' backend configuration. | ||
|
||
## Usage | ||
|
||
Instantiate the module by calling it from Terraform like this: | ||
|
||
```hcl | ||
module "state" { | ||
source = "dodevops/state/azure" | ||
version = "<version>" | ||
} | ||
``` | ||
|
||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
The following providers are used by this module: | ||
|
||
- azurerm | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
The following resources are used by this module: | ||
|
||
- [azurerm_storage_account.storage-account](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account) (resource) | ||
- [azurerm_storage_blob.storage-blob](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_blob) (resource) | ||
- [azurerm_storage_container.storage-container](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_container) (resource) | ||
|
||
## Required Inputs | ||
|
||
The following input variables are required: | ||
|
||
### location | ||
|
||
Description: The azure location used for azure | ||
|
||
Type: `string` | ||
|
||
### project | ||
|
||
Description: Three letter project key | ||
|
||
Type: `string` | ||
|
||
### resource\_group | ||
|
||
Description: Name of the resource group to use | ||
|
||
Type: `string` | ||
|
||
### size | ||
|
||
Description: Size of state blob in bytes | ||
|
||
Type: `string` | ||
|
||
### stage | ||
|
||
Description: Name of the stage for this state | ||
|
||
Type: `string` | ||
|
||
## Optional Inputs | ||
|
||
No optional inputs. | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END_TF_DOCS --> | ||
|
||
## Development | ||
|
||
Use [terraform-docs](https://terraform-docs.io/) to generate the API documentation by running | ||
|
||
terraform fmt . | ||
terraform-docs . |
This file contains 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,26 @@ | ||
# Azure Storage blob for state storage | ||
|
||
resource "azurerm_storage_account" "storage-account" { | ||
name = "${lower(var.project)}${lower(var.stage)}stateacc" | ||
resource_group_name = var.resource_group | ||
location = var.location | ||
account_tier = "Standard" | ||
account_replication_type = "ZRS" | ||
enable_https_traffic_only = false | ||
} | ||
|
||
resource "azurerm_storage_container" "storage-container" { | ||
name = "${lower(var.project)}${lower(var.stage)}statecont" | ||
storage_account_name = azurerm_storage_account.storage-account.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_blob" "storage-blob" { | ||
name = "${lower(var.project)}${lower(var.stage)}stateblob" | ||
|
||
storage_account_name = azurerm_storage_account.storage-account.name | ||
storage_container_name = azurerm_storage_container.storage-container.name | ||
|
||
type = "Block" | ||
size = var.size | ||
} |
This file contains 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,24 @@ | ||
variable "project" { | ||
type = string | ||
description = "Three letter project key" | ||
} | ||
|
||
variable "stage" { | ||
type = string | ||
description = "Name of the stage for this state" | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "The azure location used for azure" | ||
} | ||
|
||
variable "resource_group" { | ||
type = string | ||
description = "Name of the resource group to use" | ||
} | ||
|
||
variable "size" { | ||
type = string | ||
description = "Size of state blob in bytes" | ||
} |