From 6c6c1261046fac0054441581036715526fc1c7bf Mon Sep 17 00:00:00 2001 From: Iryna Lyakhova Date: Fri, 19 Jul 2024 09:13:13 +0300 Subject: [PATCH 1/4] Solution --- main.tf | 7 +++++++ modules/resource_group_storage/main.tf | 12 ++++++++++++ modules/resource_group_storage/outputs.tf | 7 +++++++ modules/resource_group_storage/variables.tf | 15 +++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 main.tf create mode 100644 modules/resource_group_storage/main.tf create mode 100644 modules/resource_group_storage/outputs.tf create mode 100644 modules/resource_group_storage/variables.tf diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..76ccd8e --- /dev/null +++ b/main.tf @@ -0,0 +1,7 @@ +module "task6" { + source = "github.com/ILyakhova/terraform-azurerm-resource_group_storage" + + resource_group_name = "example-rg" + location = "East US" + storage_account_name = "examplestorage" +} diff --git a/modules/resource_group_storage/main.tf b/modules/resource_group_storage/main.tf new file mode 100644 index 0000000..7335815 --- /dev/null +++ b/modules/resource_group_storage/main.tf @@ -0,0 +1,12 @@ +resource "azurerm_resource_group" "task6" { + name = var.resource_group_name + location = var.location +} + +resource "azurerm_storage_account" "task6" { + name = var.storage_account_name + resource_group_name = azurerm_resource_group.task6.name + location = azurerm_resource_group.task6.location + account_tier = "Standard" + account_replication_type = "LRS" +} diff --git a/modules/resource_group_storage/outputs.tf b/modules/resource_group_storage/outputs.tf new file mode 100644 index 0000000..3d38260 --- /dev/null +++ b/modules/resource_group_storage/outputs.tf @@ -0,0 +1,7 @@ +output "resource_group_name" { + value = azurerm_resource_group.task6.name +} + +output "storage_account_name" { + value = azurerm_storage_account.task6.name +} diff --git a/modules/resource_group_storage/variables.tf b/modules/resource_group_storage/variables.tf new file mode 100644 index 0000000..e308bb2 --- /dev/null +++ b/modules/resource_group_storage/variables.tf @@ -0,0 +1,15 @@ +variable "resource_group_name" { + description = "Resource group name" + type = string +} + +variable "location" { + description = "Resource group location" + type = string +} + +variable "storage_account_name" { + description = "Storage account name" + type = string +} + From 6a10a1f0767071fd9ab29ed56dd20a61c413ca39 Mon Sep 17 00:00:00 2001 From: ILyakhova <156577557+ILyakhova@users.noreply.github.com> Date: Fri, 19 Jul 2024 09:37:47 +0300 Subject: [PATCH 2/4] Update main.tf --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 76ccd8e..b13ba6f 100644 --- a/main.tf +++ b/main.tf @@ -1,4 +1,4 @@ -module "task6" { +module "resource_group_storage" { source = "github.com/ILyakhova/terraform-azurerm-resource_group_storage" resource_group_name = "example-rg" From 445d2a1d88ef6710adc80573d61731056ab4ddeb Mon Sep 17 00:00:00 2001 From: Iryna Lyakhova Date: Fri, 19 Jul 2024 09:40:58 +0300 Subject: [PATCH 3/4] Some changes --- main.tf | 2 +- modules/resource_group_storage/variables.tf | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 76ccd8e..b13ba6f 100644 --- a/main.tf +++ b/main.tf @@ -1,4 +1,4 @@ -module "task6" { +module "resource_group_storage" { source = "github.com/ILyakhova/terraform-azurerm-resource_group_storage" resource_group_name = "example-rg" diff --git a/modules/resource_group_storage/variables.tf b/modules/resource_group_storage/variables.tf index e308bb2..58aa9ef 100644 --- a/modules/resource_group_storage/variables.tf +++ b/modules/resource_group_storage/variables.tf @@ -1,15 +1,17 @@ variable "resource_group_name" { description = "Resource group name" type = string + default = "task6" } variable "location" { description = "Resource group location" type = string + default = "East US" } variable "storage_account_name" { description = "Storage account name" type = string + default = "task6-storage-account" } - From c5dfb31a37d5d2af916a19f0b0e72ca47680160a Mon Sep 17 00:00:00 2001 From: Iryna Lyakhova Date: Fri, 19 Jul 2024 09:45:36 +0300 Subject: [PATCH 4/4] fmt main.tf --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index b13ba6f..83b491c 100644 --- a/main.tf +++ b/main.tf @@ -1,7 +1,7 @@ module "resource_group_storage" { source = "github.com/ILyakhova/terraform-azurerm-resource_group_storage" - resource_group_name = "example-rg" - location = "East US" - storage_account_name = "examplestorage" + resource_group_name = "example-rg" + location = "East US" + storage_account_name = "examplestorage" }