Skip to content

Commit

Permalink
Add Azure Storage Accounts and basic storage resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibor Eszes authored and ttarczynski committed Jul 15, 2021
1 parent 9273784 commit e6b2b53
Show file tree
Hide file tree
Showing 31 changed files with 566 additions and 0 deletions.
7 changes: 7 additions & 0 deletions INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
| `aws_s3_bucket` | [aws, backends, s3](backends/s3/aws_s3_bucket) |
| `aws_vpc` | [aws](aws/aws_vpc/simple) |
| `aws_eks` | [aws, spot_and_fargate](aws/aws_eks/fargate/spot_and_fargate) |
| `azurerm_managed_disk` | [empty](azurerm/azurerm_managed_disk/empty) <p/> [copy](azurerm/azurerm_managed_disk/copy) |
| `azurerm_storage_account` | [simple](azurerm/azurerm_storage_account/simple) |
| `azurerm_storage_blob` | [append](azurerm/azurerm_storage_blob/append) <p/> [block](azurerm/azurerm_storage_blob/block) <p/> [page](azurerm/azurerm_storage_blob/page) |
| `azurerm_storage_container` | [simple](azurerm/azurerm_storage_container/simple) |
| `azurerm_storage_queue` | [simple](azurerm/azurerm_storage_queue/simple) |
| `azurerm_storage_share` | [simple](azurerm/azurerm_storage_share/simple) |
| `azurerm_storage_table` | [simple](azurerm/azurerm_storage_table/simple) |
| `azurerm_virtual_network` | [azure](azurerm/azurerm_virtual_network/simple) |
| `backends` | [backends](backends) <p/> [aws, s3, aws_s3_bucket](backends/s3/aws_s3_bucket) <p/> [aws, remote](backends/remote) <p/> [google, gcs_bucket](backends/gcs/google_storage_bucket) |
| `count` | [aws, aws_instance](aws/aws_instance/count) <p/> [aws, aws_vpc](aws/aws_vpc/count) <p/> [google, gcp_attached_disk](google/google_compute_attached_disk/count) |
Expand Down
2 changes: 2 additions & 0 deletions azurerm/azurerm_managed_disk/copy/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/destroy.sh azurerm
59 changes: 59 additions & 0 deletions azurerm/azurerm_managed_disk/copy/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Summary: An copy Azure Managed Disk created form another Azure Managed Disk

# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 0.14.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.0"
}
}
}

# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "azure_subscription_id" {
type = string
}

# Documentation: https://www.terraform.io/docs/language/providers/requirements.html
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
provider "azurerm" {
features {}

subscription_id = var.azure_subscription_id
}

# Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group
resource "azurerm_resource_group" "changeme_copy_managed_disk_resource_group" {
name = "changeme-copy-storage-table-resource-group"
location = "West Europe"
}

# Managed Disk in the Resource Group
# Explanation: Managed Disks are housed in a managed Storage Account that can not be otherwise accessed
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_disk
resource "azurerm_managed_disk" "changeme_copy_managed_disk_template_managed_disk" {
name = "changeme-copy-managed-disk-template-managed-disk-name"
location = "West US"

disk_size_gb = "1"

create_option = "Empty"
resource_group_name = azurerm_resource_group.changeme_copy_managed_disk_resource_group.name
storage_account_type = "Standard_LRS"
}

# Managed Disk copied from another Managed Disk in the same Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_disk
resource "azurerm_managed_disk" "changeme_copy_managed_disk" {
name = "changeme-copy-managed-disk-name"
location = "West US"

source_resource_id = azurerm_managed_disk.changeme_copy_managed_disk_template_managed_disk.id

create_option = "Copy"
resource_group_name = azurerm_resource_group.changeme_copy_managed_disk_resource_group.name
storage_account_type = "Standard_LRS"
}
2 changes: 2 additions & 0 deletions azurerm/azurerm_managed_disk/copy/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/apply.sh azurerm
2 changes: 2 additions & 0 deletions azurerm/azurerm_managed_disk/empty/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/destroy.sh azurerm
46 changes: 46 additions & 0 deletions azurerm/azurerm_managed_disk/empty/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Summary: An empty Azure Managed Disk

# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 0.14.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.0"
}
}
}

# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "azure_subscription_id" {
type = string
}

# Documentation: https://www.terraform.io/docs/language/providers/requirements.html
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
provider "azurerm" {
features {}

subscription_id = var.azure_subscription_id
}

# Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group
resource "azurerm_resource_group" "changeme_empty_managed_disk_resource_group" {
name = "changeme-empty-storage-table-resource-group"
location = "West Europe"
}

# Managed Disk in the Storage Account
# Explanation: Managed Disks are housed in a managed Storage Account that can not be otherwise accessed
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_disk
resource "azurerm_managed_disk" "changeme_empty_managed_disk" {
name = "changeme-empty-managed-disk-name"
location = "West US"

disk_size_gb = "1"

create_option = "Empty"
resource_group_name = azurerm_resource_group.changeme_empty_managed_disk_resource_group.name
storage_account_type = "Standard_LRS"
}
2 changes: 2 additions & 0 deletions azurerm/azurerm_managed_disk/empty/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/apply.sh azurerm
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_account/simple/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/destroy.sh azurerm
42 changes: 42 additions & 0 deletions azurerm/azurerm_storage_account/simple/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Summary: A simple Azure Storage Account

# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 0.14.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.0"
}
}
}

# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "azure_subscription_id" {
type = string
}

# Documentation: https://www.terraform.io/docs/language/providers/requirements.html
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
provider "azurerm" {
features {}

subscription_id = var.azure_subscription_id
}

# Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group
resource "azurerm_resource_group" "changeme_simple_storage_account_resource_group" {
name = "changeme-simple-storage-account-resource-group"
location = "West Europe"
}

# Storage Account within the Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account
resource "azurerm_storage_account" "changeme_simple_storage_account" {
name = "changemesimplesaname"
resource_group_name = azurerm_resource_group.changeme_simple_storage_account_resource_group.name
location = azurerm_resource_group.changeme_simple_storage_account_resource_group.location
account_tier = "Standard"
account_replication_type = "LRS"
}
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_account/simple/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/apply.sh azurerm
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_blob/append/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/destroy.sh azurerm
59 changes: 59 additions & 0 deletions azurerm/azurerm_storage_blob/append/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Summary: An Azure Storage Blob using Append Block storage
# Explanation: Append Blocks are block storage optimized for append operations

# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 0.14.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.0"
}
}
}

# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "azure_subscription_id" {
type = string
}

# Documentation: https://www.terraform.io/docs/language/providers/requirements.html
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
provider "azurerm" {
features {}

subscription_id = var.azure_subscription_id
}

# Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group
resource "azurerm_resource_group" "changeme_append_storage_blob_resource_group" {
name = "changeme-append-storage-blob-resource-group"
location = "West Europe"
}

# Storage Account within the Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account
resource "azurerm_storage_account" "changeme_append_storage_blob_storage_account" {
name = "changemeappendbsaname"
resource_group_name = azurerm_resource_group.changeme_append_storage_blob_resource_group.name
location = azurerm_resource_group.changeme_append_storage_blob_resource_group.location
account_tier = "Standard"
account_replication_type = "LRS"
}

# Storage Container in the Storage Account
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_container
resource "azurerm_storage_container" "changeme_append_storage_blob_storage_container" {
name = "changemeappendbsacname"
storage_account_name = azurerm_storage_account.changeme_append_storage_blob_storage_account.name
}

# Append Block Storage Blob in the Storage Container
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_blob
resource "azurerm_storage_blob" "changeme_append_storage_blob" {
name = "changemeappendblobname"
storage_account_name = azurerm_storage_account.changeme_append_storage_blob_storage_account.name
storage_container_name = azurerm_storage_container.changeme_append_storage_blob_storage_container.name
type = "Append"
}
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_blob/append/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/apply.sh azurerm
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_blob/block/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/destroy.sh azurerm
58 changes: 58 additions & 0 deletions azurerm/azurerm_storage_blob/block/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Summary: An Azure Storage Blob using Block storage

# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 0.14.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.0"
}
}
}

# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "azure_subscription_id" {
type = string
}

# Documentation: https://www.terraform.io/docs/language/providers/requirements.html
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
provider "azurerm" {
features {}

subscription_id = var.azure_subscription_id
}

# Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group
resource "azurerm_resource_group" "changeme_block_storage_blob_resource_group" {
name = "changeme-block-storage-blob-resource-group"
location = "West Europe"
}

# Storage Account within the Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account
resource "azurerm_storage_account" "changeme_block_storage_blob_storage_account" {
name = "changemeblockbsaname"
resource_group_name = azurerm_resource_group.changeme_block_storage_blob_resource_group.name
location = azurerm_resource_group.changeme_block_storage_blob_resource_group.location
account_tier = "Standard"
account_replication_type = "LRS"
}

# Storage Container in the Storage Account
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_container
resource "azurerm_storage_container" "changeme_block_storage_blob_storage_container" {
name = "changemeblockbsacname"
storage_account_name = azurerm_storage_account.changeme_block_storage_blob_storage_account.name
}

# Block Storage Blob in the Storage Container
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_blob
resource "azurerm_storage_blob" "changeme_block_storage_blob" {
name = "changemeblockblobname"
storage_account_name = azurerm_storage_account.changeme_block_storage_blob_storage_account.name
storage_container_name = azurerm_storage_container.changeme_block_storage_blob_storage_container.name
type = "Block"
}
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_blob/block/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/apply.sh azurerm
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_blob/page/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/destroy.sh azurerm
59 changes: 59 additions & 0 deletions azurerm/azurerm_storage_blob/page/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Summary: An Azure Storage Blob using Page storage

# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 0.14.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.0"
}
}
}

# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "azure_subscription_id" {
type = string
}

# Documentation: https://www.terraform.io/docs/language/providers/requirements.html
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
provider "azurerm" {
features {}

subscription_id = var.azure_subscription_id
}

# Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group
resource "azurerm_resource_group" "changeme_page_storage_blob_resource_group" {
name = "changeme-page-storage-blob-resource-group"
location = "West Europe"
}

# Storage Account within the Resource Group
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account
resource "azurerm_storage_account" "changeme_page_storage_blob_storage_account" {
name = "changemepagebsaname"
resource_group_name = azurerm_resource_group.changeme_page_storage_blob_resource_group.name
location = azurerm_resource_group.changeme_page_storage_blob_resource_group.location
account_tier = "Standard"
account_replication_type = "LRS"
}

# Storage Container in the Storage Account
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_container
resource "azurerm_storage_container" "changeme_page_storage_blob_storage_container" {
name = "changemepagebsacname"
storage_account_name = azurerm_storage_account.changeme_page_storage_blob_storage_account.name
}

# Page Storage Blob in the Storage Container
# Documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_blob
resource "azurerm_storage_blob" "changeme_page_storage_blob" {
name = "changemepageblobname"
storage_account_name = azurerm_storage_account.changeme_page_storage_blob_storage_account.name
storage_container_name = azurerm_storage_container.changeme_page_storage_blob_storage_container.name
type = "Page"
size = 512
}
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_blob/page/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/apply.sh azurerm
2 changes: 2 additions & 0 deletions azurerm/azurerm_storage_container/simple/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
../../../bin/destroy.sh azurerm
Loading

0 comments on commit e6b2b53

Please sign in to comment.