diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..980e37d --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Local .terraform directories +**/.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 \ No newline at end of file diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..aa154c4 --- /dev/null +++ b/main.tf @@ -0,0 +1,5 @@ +module "resource_group_storage" { + source = "yaaszp/resource_group_storage/azurerm" + version = "1.0.0" +} + diff --git a/modules/resource_group_storage/main.tf b/modules/resource_group_storage/main.tf new file mode 100644 index 0000000..719b514 --- /dev/null +++ b/modules/resource_group_storage/main.tf @@ -0,0 +1,26 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "3.105.0" + } + } +} + +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "rg" { + name = var.resource_group_name + location = var.location_for_rg +} + +resource "azurerm_storage_account" "storage_account" { + 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..53f1bf5 --- /dev/null +++ b/modules/resource_group_storage/outputs.tf @@ -0,0 +1,10 @@ +output "resource_group_id" { + value = azurerm_resource_group.rg.id + sensitive = true +} + +output "storage_account_id" { + value = azurerm_storage_account.storage_account.id + sensitive = true +} + diff --git a/modules/resource_group_storage/variables.tf b/modules/resource_group_storage/variables.tf new file mode 100644 index 0000000..087a711 --- /dev/null +++ b/modules/resource_group_storage/variables.tf @@ -0,0 +1,17 @@ +variable "resource_group_name" { + type = string + default = "task-6-rg" + description = "Resource group Name" +} + +variable "location_for_rg" { + type = string + default = "West Europe" + description = "Location for the resources" +} + +variable "storage_account_name" { + type = string + default = "task-6-yaas-storage-account" + description = "Storage account Name" +} \ No newline at end of file