From 741ae350ec90674ff1b958c3486d884d81eb03f8 Mon Sep 17 00:00:00 2001 From: cthusq Date: Tue, 24 Sep 2024 20:05:10 +0300 Subject: [PATCH] Solution --- .gitignore | 31 ++++++++++++++++++++ main.tf | 28 ++++++++++++++++++ modules/resource_group_storage/main.tf | 12 ++++++++ modules/resource_group_storage/outputs.tf | 9 ++++++ modules/resource_group_storage/variables.tf | 15 ++++++++++ tfplan | Bin 0 -> 4638 bytes 6 files changed, 95 insertions(+) create mode 100644 .gitignore 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 create mode 100644 tfplan diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2582f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +# Local .terraform directories & files +**/.terraform/* +*terraform +.terraform* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Ignore CLI configuration files +.terraformrc +terraform.rc + +# Ignore for zip files +*.zip + +index.html diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..706d978 --- /dev/null +++ b/main.tf @@ -0,0 +1,28 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 3.0" + } + } +} + +provider "azurerm" { + features {} +} + +output "resource_group_id" { + value = module.resource_group_storage.resource_group_id +} + +output "storage_account_id" { + value = module.resource_group_storage.storage_account_id +} + +module "resource_group_storage" { + source = "cth-usq/resource_group_storage/azurerm" + version = "1.0.1" + resource_group_name = "my-resource-group" + location = "East US" + storage_account_name = "mystorageaccount771" +} diff --git a/modules/resource_group_storage/main.tf b/modules/resource_group_storage/main.tf new file mode 100644 index 0000000..ac7c4f9 --- /dev/null +++ b/modules/resource_group_storage/main.tf @@ -0,0 +1,12 @@ +resource "azurerm_resource_group" "rg" { + name = var.resource_group_name + location = var.location +} + +resource "azurerm_storage_account" "sa" { + name = var.storage_account_name + resource_group_name = azurerm_resource_group.rg.name + location = azurerm_resource_group.rg.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..f276142 --- /dev/null +++ b/modules/resource_group_storage/outputs.tf @@ -0,0 +1,9 @@ +output "resource_group_id" { + value = azurerm_resource_group.rg.id + description = "The ID of the resource group" +} + +output "storage_account_id" { + value = azurerm_storage_account.sa.id + description = "The ID of the storage account" +} diff --git a/modules/resource_group_storage/variables.tf b/modules/resource_group_storage/variables.tf new file mode 100644 index 0000000..47e534a --- /dev/null +++ b/modules/resource_group_storage/variables.tf @@ -0,0 +1,15 @@ +variable "resource_group_name" { + type = string + description = "Name of the resource group" +} + +variable "location" { + type = string + description = "Azure region where resources will be created" + default = "West Europe" +} + +variable "storage_account_name" { + type = string + description = "Name of the storage account" +} diff --git a/tfplan b/tfplan new file mode 100644 index 0000000000000000000000000000000000000000..5f5fa88757638cee71d72957a6305245ed7b09b6 GIT binary patch literal 4638 zcmd5PBhE*tX58Z?fDN__4i{VbNj^oydO>%h2(nwBZ^BT;S@ zSGmj}m_cQI<^8*Q1d}=hk$Xv4B|B?Y^RV`E|7&;E$*$H^tHi|GWvRcc7slQ#mBdVD zOpxzR-zPg}-4)$h=uoBwzlO9Pxl28%W2_Q$Suhk!#jkan;bGf)oqQ5Zqi(S;$=UV> zqNfxbWGRsX&efR+#ut~^kJp?N#Cns3`Ha4OExBklK*gXC+NYO#c9B5WO(j644oB)B zCh7~cbo{);NdPkLvsImKt-ZsMJJNxVL9G?N+&=RWccn9YNYB*^U*Ji-xJsd+=X~)u+BdICIuWrjQFTvlrvrA+|`2d}&VF^iYd`vy83fWPQ!x z@FtM1o{z&KO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