From 1c844ba83e23c060ab00eb337e51dd0f322eb683 Mon Sep 17 00:00:00 2001 From: Praven John Date: Tue, 14 Nov 2023 12:29:53 +0530 Subject: [PATCH] Fixing the dos endings --- .../orphan_snapshots.csv | 8 +- .../unused_vol.csv | 6 +- terraform/azure/examples/main.tf | 72 +++---- terraform/azure/modules/vnet/locals.tf | 4 +- terraform/azure/modules/vnet/outputs.tf | 20 +- terraform/azure/modules/vnet/variables.tf | 186 +++++++++--------- terraform/azure/modules/vnet/vnet.tf | 172 ++++++++-------- 7 files changed, 234 insertions(+), 234 deletions(-) diff --git a/scripts/unused_vol_and_orphan_snap_report/orphan_snapshots.csv b/scripts/unused_vol_and_orphan_snap_report/orphan_snapshots.csv index b0bfff7..c813702 100644 --- a/scripts/unused_vol_and_orphan_snap_report/orphan_snapshots.csv +++ b/scripts/unused_vol_and_orphan_snap_report/orphan_snapshots.csv @@ -1,4 +1,4 @@ -SNAPSHOT_IDS,REGION,ACTION -snap-003ca55db483999b2,ap-south-1,DEL -snap-006cd21bf396006db,ap-south-1,DEL -snap-00d8a4aed19d3eb64,us-east-1,DEL +SNAPSHOT_IDS,REGION,ACTION +snap-003ca55db483999b2,ap-south-1,DEL +snap-006cd21bf396006db,ap-south-1,DEL +snap-00d8a4aed19d3eb64,us-east-1,DEL diff --git a/scripts/unused_vol_and_orphan_snap_report/unused_vol.csv b/scripts/unused_vol_and_orphan_snap_report/unused_vol.csv index 6f83051..f8391f4 100644 --- a/scripts/unused_vol_and_orphan_snap_report/unused_vol.csv +++ b/scripts/unused_vol_and_orphan_snap_report/unused_vol.csv @@ -1,3 +1,3 @@ -VOLUME_ID,STATUS,REGION,ACTION,DESC -vol-09ca939fc08f7cedc,available,ap-south-1,DEL,volume is not attached to an instance -vol-0c5208ad4ed07f24a,available,us-east-1,DEL,volume is not attached to an instance +VOLUME_ID,STATUS,REGION,ACTION,DESC +vol-09ca939fc08f7cedc,available,ap-south-1,DEL,volume is not attached to an instance +vol-0c5208ad4ed07f24a,available,us-east-1,DEL,volume is not attached to an instance diff --git a/terraform/azure/examples/main.tf b/terraform/azure/examples/main.tf index 361c19d..ea33bf2 100644 --- a/terraform/azure/examples/main.tf +++ b/terraform/azure/examples/main.tf @@ -1,36 +1,36 @@ -module "network" { - source = "../modules/vnet" - vnet_name = "myvnet" - address_space = ["10.0.0.0/16"] - location = "eastus" - resource_group_name = "testrg" - subnet_names = ["aks_subnet", "appgw_subnet"] - subnet_address_prefixes = ["10.0.1.0/24", "10.0.2.0/24"] - nsg_name = "testnsg" - - inbound_rules = { - rule1 = { - name = "inbound_rule1" - priority = 100 - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "80" - source_address_prefix = "1.2.3.4" - destination_address_prefix = "10.0.1.0/24" - } - } - - outbound_rules = { - rule1 = { - name = "outbound_rule1" - priority = 100 - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "443" - source_address_prefix = "10.0.1.0/24" - destination_address_prefix = "5.6.7.8" - } - } -} +module "network" { + source = "../modules/vnet" + vnet_name = "myvnet" + address_space = ["10.0.0.0/16"] + location = "eastus" + resource_group_name = "testrg" + subnet_names = ["aks_subnet", "appgw_subnet"] + subnet_address_prefixes = ["10.0.1.0/24", "10.0.2.0/24"] + nsg_name = "testnsg" + + inbound_rules = { + rule1 = { + name = "inbound_rule1" + priority = 100 + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "80" + source_address_prefix = "1.2.3.4" + destination_address_prefix = "10.0.1.0/24" + } + } + + outbound_rules = { + rule1 = { + name = "outbound_rule1" + priority = 100 + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "443" + source_address_prefix = "10.0.1.0/24" + destination_address_prefix = "5.6.7.8" + } + } +} diff --git a/terraform/azure/modules/vnet/locals.tf b/terraform/azure/modules/vnet/locals.tf index 0e14b66..5866504 100644 --- a/terraform/azure/modules/vnet/locals.tf +++ b/terraform/azure/modules/vnet/locals.tf @@ -1,3 +1,3 @@ -locals { - environment = "Development" +locals { + environment = "Development" } \ No newline at end of file diff --git a/terraform/azure/modules/vnet/outputs.tf b/terraform/azure/modules/vnet/outputs.tf index f6daf4a..bb6e442 100644 --- a/terraform/azure/modules/vnet/outputs.tf +++ b/terraform/azure/modules/vnet/outputs.tf @@ -1,10 +1,10 @@ -output "vnet_id" { - description = "ID of the created Azure Virtual Network" - value = azurerm_virtual_network.Vnet.id -} - -output "subnet_ids" { - description = "IDs of the created subnets" - value = azurerm_subnet.subnets.*.id -} - +output "vnet_id" { + description = "ID of the created Azure Virtual Network" + value = azurerm_virtual_network.Vnet.id +} + +output "subnet_ids" { + description = "IDs of the created subnets" + value = azurerm_subnet.subnets.*.id +} + diff --git a/terraform/azure/modules/vnet/variables.tf b/terraform/azure/modules/vnet/variables.tf index aaf2b00..6a2d121 100644 --- a/terraform/azure/modules/vnet/variables.tf +++ b/terraform/azure/modules/vnet/variables.tf @@ -1,93 +1,93 @@ -variable "vnet_name" { - description = "Name of the Azure Virtual Network" - default = "testvnet" - type = string -} - -variable "address_space" { - description = "Address space for the Azure Virtual Network" - default = ["10.0.0.0/16"] - type = list(string) -} - -variable "location" { - description = "Azure region where the resources will be created" - default = "us-east-1" - type = string -} - -variable "resource_group_name" { - description = "Name of the Azure Resource Group" - default = "testrg" - type = string -} - -variable "subnet_names" { - description = "Names of the subnets" - default = ["testsubnet"] - type = list(string) -} - -variable "subnet_address_prefixes" { - description = "Address prefixes for the subnets" - default = ["10.0.1.0/24"] - type = list(string) -} - -variable "nsg_name" { - description = "Name of Security group" - default = "testnsg" - type = string -} - -variable "inbound_rules" { - description = "A map of inbound security rules" - default = { - rule1 = { - name = "inbound_rule1" - priority = 100 - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "80" - source_address_prefix = "1.2.3.4" - destination_address_prefix = "10.0.1.0/24" - } - } - type = map(object({ - name = string - priority = number - access = string - protocol = string - source_port_range = string - destination_port_range = string - source_address_prefix = string - destination_address_prefix = string - })) -} - -variable "outbound_rules" { - description = "A map of outbound security rules" - default = { - rule1 = { - name = "outbound_rule1" - priority = 100 - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "443" - source_address_prefix = "10.0.1.0/24" - destination_address_prefix = "5.6.7.8" - } - } - type = map(object({ - name = string - priority = number - access = string - protocol = string - source_port_range = string - destination_port_range = string - source_address_prefix = string - destination_address_prefix = string - })) -} +variable "vnet_name" { + description = "Name of the Azure Virtual Network" + default = "testvnet" + type = string +} + +variable "address_space" { + description = "Address space for the Azure Virtual Network" + default = ["10.0.0.0/16"] + type = list(string) +} + +variable "location" { + description = "Azure region where the resources will be created" + default = "us-east-1" + type = string +} + +variable "resource_group_name" { + description = "Name of the Azure Resource Group" + default = "testrg" + type = string +} + +variable "subnet_names" { + description = "Names of the subnets" + default = ["testsubnet"] + type = list(string) +} + +variable "subnet_address_prefixes" { + description = "Address prefixes for the subnets" + default = ["10.0.1.0/24"] + type = list(string) +} + +variable "nsg_name" { + description = "Name of Security group" + default = "testnsg" + type = string +} + +variable "inbound_rules" { + description = "A map of inbound security rules" + default = { + rule1 = { + name = "inbound_rule1" + priority = 100 + access = "Allow" + protocol = "TCP" + source_port_range = "*" + destination_port_range = "80" + source_address_prefix = "1.2.3.4" + destination_address_prefix = "10.0.1.0/24" + } + } + type = map(object({ + name = string + priority = number + access = string + protocol = string + source_port_range = string + destination_port_range = string + source_address_prefix = string + destination_address_prefix = string + })) +} + +variable "outbound_rules" { + description = "A map of outbound security rules" + default = { + rule1 = { + name = "outbound_rule1" + priority = 100 + access = "Allow" + protocol = "TCP" + source_port_range = "*" + destination_port_range = "443" + source_address_prefix = "10.0.1.0/24" + destination_address_prefix = "5.6.7.8" + } + } + type = map(object({ + name = string + priority = number + access = string + protocol = string + source_port_range = string + destination_port_range = string + source_address_prefix = string + destination_address_prefix = string + })) +} diff --git a/terraform/azure/modules/vnet/vnet.tf b/terraform/azure/modules/vnet/vnet.tf index d07ef2f..eb664b2 100644 --- a/terraform/azure/modules/vnet/vnet.tf +++ b/terraform/azure/modules/vnet/vnet.tf @@ -1,86 +1,86 @@ -#To create resource group -resource "azurerm_resource_group" "resourcegroup" { - name = var.resource_group_name - location = var.location - - tags = { - Name = var.resource_group_name - Environment = "${local.environment}" - } -} - -#To create virtual network -resource "azurerm_virtual_network" "Vnet" { - name = var.vnet_name - address_space = var.address_space - location = var.location - resource_group_name = azurerm_resource_group.resourcegroup.name - - tags = { - Name = var.vnet_name - Environment = "${local.environment}" - } -} - -#To create subnets -resource "azurerm_subnet" "subnets" { - count = length(var.subnet_names) - name = var.subnet_names[count.index] - resource_group_name = azurerm_resource_group.resourcegroup.name - virtual_network_name = azurerm_virtual_network.Vnet.name - address_prefixes = [var.subnet_address_prefixes[count.index]] -} - -#To create network security group -resource "azurerm_network_security_group" "default_nsg" { - name = var.nsg_name - location = var.location - resource_group_name = azurerm_resource_group.resourcegroup.name - - tags = { - Name = var.nsg_name - Environment = "${local.environment}" - } -} - -#To add inbound rules -resource "azurerm_network_security_rule" "inbound" { - for_each = var.inbound_rules - - name = each.value.name - priority = each.value.priority - direction = "Inbound" - access = each.value.access - protocol = each.value.protocol - source_port_range = each.value.source_port_range - destination_port_range = each.value.destination_port_range - source_address_prefix = each.value.source_address_prefix - destination_address_prefix = each.value.destination_address_prefix - resource_group_name = azurerm_resource_group.resourcegroup.name - network_security_group_name = azurerm_network_security_group.default_nsg.name -} - -#To add outbound rules -resource "azurerm_network_security_rule" "outbound" { - for_each = var.outbound_rules - - name = each.value.name - priority = each.value.priority - direction = "Outbound" - access = each.value.access - protocol = each.value.protocol - source_port_range = each.value.source_port_range - destination_port_range = each.value.destination_port_range - source_address_prefix = each.value.source_address_prefix - destination_address_prefix = each.value.destination_address_prefix - resource_group_name = azurerm_resource_group.resourcegroup.name - network_security_group_name = azurerm_network_security_group.default_nsg.name -} - -#To create network security group association -resource "azurerm_subnet_network_security_group_association" "nsg_association" { - count = length(azurerm_subnet.subnets) - subnet_id = azurerm_subnet.subnets[count.index].id - network_security_group_id = azurerm_network_security_group.default_nsg.id -} - +#To create resource group +resource "azurerm_resource_group" "resourcegroup" { + name = var.resource_group_name + location = var.location + + tags = { + Name = var.resource_group_name + Environment = "${local.environment}" + } +} + +#To create virtual network +resource "azurerm_virtual_network" "Vnet" { + name = var.vnet_name + address_space = var.address_space + location = var.location + resource_group_name = azurerm_resource_group.resourcegroup.name + + tags = { + Name = var.vnet_name + Environment = "${local.environment}" + } +} + +#To create subnets +resource "azurerm_subnet" "subnets" { + count = length(var.subnet_names) + name = var.subnet_names[count.index] + resource_group_name = azurerm_resource_group.resourcegroup.name + virtual_network_name = azurerm_virtual_network.Vnet.name + address_prefixes = [var.subnet_address_prefixes[count.index]] +} + +#To create network security group +resource "azurerm_network_security_group" "default_nsg" { + name = var.nsg_name + location = var.location + resource_group_name = azurerm_resource_group.resourcegroup.name + + tags = { + Name = var.nsg_name + Environment = "${local.environment}" + } +} + +#To add inbound rules +resource "azurerm_network_security_rule" "inbound" { + for_each = var.inbound_rules + + name = each.value.name + priority = each.value.priority + direction = "Inbound" + access = each.value.access + protocol = each.value.protocol + source_port_range = each.value.source_port_range + destination_port_range = each.value.destination_port_range + source_address_prefix = each.value.source_address_prefix + destination_address_prefix = each.value.destination_address_prefix + resource_group_name = azurerm_resource_group.resourcegroup.name + network_security_group_name = azurerm_network_security_group.default_nsg.name +} + +#To add outbound rules +resource "azurerm_network_security_rule" "outbound" { + for_each = var.outbound_rules + + name = each.value.name + priority = each.value.priority + direction = "Outbound" + access = each.value.access + protocol = each.value.protocol + source_port_range = each.value.source_port_range + destination_port_range = each.value.destination_port_range + source_address_prefix = each.value.source_address_prefix + destination_address_prefix = each.value.destination_address_prefix + resource_group_name = azurerm_resource_group.resourcegroup.name + network_security_group_name = azurerm_network_security_group.default_nsg.name +} + +#To create network security group association +resource "azurerm_subnet_network_security_group_association" "nsg_association" { + count = length(azurerm_subnet.subnets) + subnet_id = azurerm_subnet.subnets[count.index].id + network_security_group_id = azurerm_network_security_group.default_nsg.id +} +