Skip to content

Commit

Permalink
Merge pull request #1 from PashmakGuru/refactor/terraform-fmt
Browse files Browse the repository at this point in the history
🔨 Reformat Terraform Files
  • Loading branch information
AmirrezaNasiri authored Jan 4, 2024
2 parents 26a80d1 + ca2df52 commit 5c6e885
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions 01-providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ terraform {
version = "~> 3.79.0"
}
helm = {
source = "hashicorp/helm"
source = "hashicorp/helm"
version = "~> 2.12.1"
}
azapi = {
Expand All @@ -17,7 +17,7 @@ terraform {
version = "~>3.0"
}
azuread = {
source = "hashicorp/azuread"
source = "hashicorp/azuread"
version = "2.47.0"
}
}
Expand Down
8 changes: 4 additions & 4 deletions 02-locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ locals {
id = "${var.name}-${var.environment}"

Check warning on line 2 in 02-locals.tf

View workflow job for this annotation

GitHub Actions / Lint Terraform

local.id is declared but not used
common_tags = {
module = "blob-storage"
name = var.name
env = var.environment
name = var.name
env = var.environment
}
rbac = {
for r in var.rbac:
"${r.identity_resource_group}-${r.identity_name}" => r
for r in var.rbac :
"${r.identity_resource_group}-${r.identity_name}" => r
}
}
2 changes: 1 addition & 1 deletion 03-resource-group.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "azurerm_resource_group" "this" {
name = var.resource_group_name
location = var.location
tags = local.common_tags
tags = local.common_tags
}
22 changes: 11 additions & 11 deletions example/instance.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
identity_resource_group_name = "module-azure-blob-storage-example-identities"
storage_resource_group_name = "module-azure-blob-storage-example-main"
storage_resource_group_name = "module-azure-blob-storage-example-main"
}

resource "azurerm_resource_group" "this" {
Expand All @@ -21,21 +21,21 @@ resource "azurerm_user_assigned_identity" "app2" {
}

module "storage_blob" {
source = "./../"
source = "./../"

depends_on = [ azurerm_user_assigned_identity.app1, azurerm_user_assigned_identity.app2 ]
depends_on = [azurerm_user_assigned_identity.app1, azurerm_user_assigned_identity.app2]

name = "module-example"
environment = "prod"
name = "module-example"
environment = "prod"
resource_group_name = local.storage_resource_group_name
location = var.location
container_names = [ "test1", "test2" ]
location = var.location
container_names = ["test1", "test2"]
rbac = [
{
identity_name = "app1"
identity_resource_group = local.identity_resource_group_name
container_name = "test1"
role = "Storage Blob Data Contributor"
identity_name = "app1"
identity_resource_group = local.identity_resource_group_name
container_name = "test1"
role = "Storage Blob Data Contributor"
}
]
}
8 changes: 4 additions & 4 deletions example/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_providers {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.79.0"
Expand All @@ -21,7 +21,7 @@ provider "azurerm" {

# Connection to Azure
subscription_id = var.azure_subscription_id
client_id = var.azure_client_id
client_secret = var.azure_client_secret
tenant_id = var.azure_tenant_id
client_id = var.azure_client_id
client_secret = var.azure_client_secret
tenant_id = var.azure_tenant_id
}
2 changes: 1 addition & 1 deletion example/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ variable "azure_tenant_id" {
}

variable "location" {
type = string
type = string
default = "West US"
}
18 changes: 9 additions & 9 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variable "name" {
type = string
type = string

validation {
condition = can(regex("^[a-z0-9-]+$", var.name))
Expand All @@ -8,17 +8,17 @@ variable "name" {
}

variable "location" {
type = string
default = "West Europe"
type = string
default = "West Europe"
}

variable "environment" {
type = string
default = "development"
type = string
default = "development"
}

variable "container_names" {
type = list(string)
type = list(string)
}

variable "resource_group_name" {
Expand All @@ -27,10 +27,10 @@ variable "resource_group_name" {

variable "rbac" {
type = list(object({
identity_name = string
identity_name = string
identity_resource_group = string
container_name = string
role = string
container_name = string
role = string
}))
description = "Identity names mapped to container names which are mapped to the associated role."
}
Expand Down

0 comments on commit 5c6e885

Please sign in to comment.