Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #13

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "random_id" "unique_suffix" {
byte_length = 4
}

module "resource_group_storage" {
source = "v-shutov/resource_group_storage/azurerm"
version = "1.0.2"
resource_group_name = var.resource_group_name
location = var.location
storage_account_name = "${var.storage_account_name}${random_id.unique_suffix.hex}"
}
12 changes: 12 additions & 0 deletions modules/resource_group_storage/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "azurerm_resource_group" "example" {
name = var.resource_group_name
location = var.location
}

resource "azurerm_storage_account" "example" {
name = var.storage_account_name
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}
8 changes: 8 additions & 0 deletions modules/resource_group_storage/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
output "resource_group_id" {
value = azurerm_resource_group.example.id

}

output "storage_account_id" {
value = azurerm_storage_account.example.id
}
14 changes: 14 additions & 0 deletions modules/resource_group_storage/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "resource_group_name" {
description = "The name of the resource group"
type = string
}

variable "location" {
description = "The location for all resources."
type = string
}

variable "storage_account_name" {
description = "The name of the storage account"
type = string
}
12 changes: 12 additions & 0 deletions provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.105.0"
}
}
}

provider "azurerm" {
features {}
}
17 changes: 17 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
variable "resource_group_name" {
description = "The name of the resource group"
type = string
default = "my-rg"
}

variable "location" {
description = "The location for all resources."
type = string
default = "West Europe"
}

variable "storage_account_name" {
description = "The name of the storage account"
type = string
default = "mystorageacct"
}